我第一次在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,但目前我可以采取任何解决方法吗?
我正在寻找任何可以让我在构建开始之前清除缓存,或者将构建命令自定义为不同的 gradle 任务,或者任何其他可能有帮助的东西
最佳答案
问题的一部分是 gradle-node-plugin
正在创建带有绝对路径的符号链接(symbolic link)。它可能应该创建相对路径。
无论如何,我已经打开了PR on the Gradle buildpack to exclude this dir from the cache 。一旦发布,这个问题就会消失。
关于java - Heroku 在 gradle 任务 'nodeSetup' 期间构建失败,错误为 'Couldn' t follow 符号链接(symbolic link)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55667000/