我第一次在heroku上创建应用程序时,一切正常,但是在nodeSetup
gradle任务的构建过程中,所有后续部署均失败,出现此错误
Failed to capture fingerprint of output files for task ':nodeSetup' property 'nodeDir' during up-to-date check.
> Could not list contents of '/tmp/build_f8eae163382a61b2896d7be434b4dc58/.gradle/nodejs/node-v8.12.0-linux-x64/bin/npm'. Couldn't follow symbolic link.
每次要部署此项目时,我都必须创建一个新的heroku项目。因此,这仅是第一次。即使我使用./gradlew clean
清除了缓存,在构建过程中也会失败,因为它不会清除.gradle
文件夹
如果我通过SSH进入项目并手动运行./gradlew build
,它将正常工作。该错误仅在(构建包的)heroku构建过程中发生
我正在使用https://github.com/srs/gradle-node-plugin以便将webpack用于项目https://github.com/zhcet-amu/zhcet-web中的前端。
我想很多人都遇到过类似的问题。这可能是由于缓存目录并试图在第二次部署中访问不存在的目录吗?
这是完整的构建日志
-----> Gradle app detected
-----> Spring Boot detected
-----> Installing JDK 1.8... done
-----> Building Gradle app...
-----> executing ./gradlew build -x test
> Task :bootBuildInfo
> Task :compileKotlin
> Task :nodeSetup FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture fingerprint of output files for task ':nodeSetup' property 'nodeDir' during up-to-date check.
> Could not list contents of '/tmp/build_f8eae163382a61b2896d7be434b4dc58/.gradle/nodejs/node-v8.12.0-linux-x64/bin/npm'. Couldn't follow symbolic link.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 27s
3 actionable tasks: 3 executed
! ERROR: Failed to run Gradle!
We're sorry this build is failing. If you can't find the issue in application
code, please submit a ticket so we can help: https://help.heroku.com
You can also try reverting to the previous version of the buildpack by running:
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#previous-version
Thanks,
Heroku
! Push rejected, failed to compile Gradle app.
! Push failed
就个人而言,我不在乎是否缓存了任何内容,并且重建所需的时间比目前更长,甚至无法部署。我很乐意向我发送PR,如果该指南指导您在此处需要执行的操作,但是目前,我可以采取任何解决方法吗?
我正在寻找可以让我在构建开始之前清除缓存,或者将build命令自定义为其他gradle任务的东西,或者其他可能有用的东西
答案 0 :(得分:1)
问题的一部分是gradle-node-plugin
正在使用绝对路径创建符号链接。它可能应该在创建相对路径。
无论如何,我都打开了PR on the Gradle buildpack to exclude this dir from the cache。发布后,该问题就消失了。