简体   繁体   中英

Heroku build failed during gradle task 'nodeSetup' with error 'Couldn't follow symbolic link'

The first time I create an application on heroku, everything works fine, but all subsequent deploys fail during build process during the nodeSetup gradle task with this error

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.

I have to create a new heroku project every time I want to deploy this. So, it only works for the first time. Even if I clear the cache using ./gradlew clean , it fails during the build because it does not clear the .gradle folder

If I SSH into the project and manually run ./gradlew build , it works without a problem. The error only happens during the heroku build process (of the buildpack)

I am using https://github.com/srs/gradle-node-plugin in order to use webpack for the frontend in the project https://github.com/zhcet-amu/zhcet-web .

I guess similar issues have been encountered by many people. This may be due to caching the directory and trying to access non-existent one on second deploy?

This is the full build log

-----> 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

Personally, I don't care if anything is cached or not and rebuilding takes longer as currently, deployments don't even work. I'd love to send a PR if guided in the direction of what needs to be done here, but for now, is there any workaround I can do?

I am looking for anything that can either let me clear the cache before building starts, or customize the build command to a different gradle task, or anything else that may help

A part of the problem is the gradle-node-plugin is creating symlinks with absolute paths. It should probably be creating relative paths.

In any case, I've opened a PR on the Gradle buildpack to exclude this dir from the cache . Once that's released, this problem should go away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM