mars/heroku-nextjs

Error building - cross-device link not permitted

tgoldenberg opened this issue · 4 comments

The error message is too cryptic for me to understand. Previous builds have been working fine, and there shouldn't be many changes to cause this to happen.

Here is the build log:

Counting objects: 173, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (166/166), done.
Writing objects: 100% (173/173), 1.67 MiB | 0 bytes/s, done.
Total 173 (delta 79), reused 1 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NPM_CONFIG_PRODUCTION=true
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  6.9.x
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 6.9.x via semver.io...
remote:        Downloading and installing node 6.9.5...
remote:        Using default npm version: 3.10.10
remote:
remote: -----> Restoring cache
remote:        Loading 1 from cacheDirectories (package.json):
remote:        - nextjs/node_modules
remote:
remote: -----> Building dependencies
remote:        Installing node modules (package.json)
remote:
remote:        > node-sass@4.5.0 install /tmp/build_5d58160df57c635efb9f66645d150168/node_modules/node-sass
remote:        > node scripts/install.js
remote:
remote:        Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.0/linux-x64-48_binding.node
remote:        Download complete
remote:        Binary saved to /tmp/build_5d58160df57c635efb9f66645d150168/node_modules/node-sass/vendor/linux-x64-48/binding.node
remote:        Caching binary to /app/.npm/node-sass/4.5.0/linux-x64-48_binding.node
remote:
remote:        > node-sass@4.5.0 postinstall /tmp/build_5d58160df57c635efb9f66645d150168/node_modules/node-sass
remote:        > node scripts/build.js
remote:
remote:        Binary found at /tmp/build_5d58160df57c635efb9f66645d150168/node_modules/node-sass/vendor/linux-x64-48/binding.node
remote:        Testing binary
remote:        Binary is fine
remote:
remote:        > commandiv-next@1.0.0 postinstall /tmp/build_5d58160df57c635efb9f66645d150168
remote:        > heroku-nextjs-build
remote:
remote:
remote:        > commandiv-next@1.0.0 build /app/nextjs
remote:        > next build
remote:
remote:        > Using external babel configuration
remote:        > location: "/app/nextjs/.babelrc"
remote:        > Using "webpack" config function defined in next.config.js.
remote:        { Error: EXDEV: cross-device link not permitted, rename '/app/nextjs/.next' -> '/tmp/8066790f-4d88-4a6e-bc3e-4d9e575bc315/.next.old'
remote:        at Error (native)
remote:        errno: -18,
remote:        code: 'EXDEV',
remote:        syscall: 'rename',
remote:        path: '/app/nextjs/.next',
remote:        dest: '/tmp/8066790f-4d88-4a6e-bc3e-4d9e575bc315/.next.old' }
remote:
remote:        npm ERR! Linux 3.13.0-105-generic
remote:        npm ERR! argv "/tmp/build_5d58160df57c635efb9f66645d150168/.heroku/node/bin/node" "/tmp/build_5d58160df57c635efb9f66645d150168/.heroku/node/bin/npm" "run" "build"
remote:        npm ERR! node v6.9.5
remote:        npm ERR! npm  v3.10.10
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! commandiv-next@1.0.0 build: `next build`
remote:        npm ERR! Exit status 1
remote:        npm ERR!
remote:        npm ERR! Failed at the commandiv-next@1.0.0 build script 'next build'.
remote:        npm ERR! Make sure you have the latest version of node.js and npm installed.
remote:        npm ERR! If you do, this is most likely a problem with the commandiv-next package,
remote:        npm ERR! not with npm itself.
remote:        npm ERR! Tell the author that this fails on your system:
remote:        npm ERR!     next build
remote:        npm ERR! You can get information on how to open an issue for this project with:
remote:        npm ERR!     npm bugs commandiv-next
remote:        npm ERR! Or if that isn't available, you can get their info via:
remote:        npm ERR!     npm owner ls commandiv-next
remote:        npm ERR! There is likely additional logging output above.
remote:
remote:        npm ERR! Please include the following file with any support request:
remote:        npm ERR!     /app/nextjs/npm-debug.log
remote:
remote:        npm ERR! Linux 3.13.0-105-generic
remote:        npm ERR! argv "/tmp/build_5d58160df57c635efb9f66645d150168/.heroku/node/bin/node" "/tmp/build_5d58160df57c635efb9f66645d150168/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_5d58160df57c635efb9f66645d150168/.npmrc"
remote:        npm ERR! node v6.9.5
remote:        npm ERR! npm  v3.10.10
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! commandiv-next@1.0.0 postinstall: `heroku-nextjs-build`
remote:        npm ERR! Exit status 1
remote:        npm ERR!
remote:        npm ERR! Failed at the commandiv-next@1.0.0 postinstall script 'heroku-nextjs-build'.
remote:        npm ERR! Make sure you have the latest version of node.js and npm installed.
remote:        npm ERR! If you do, this is most likely a problem with the commandiv-next package,
remote:        npm ERR! not with npm itself.
remote:        npm ERR! Tell the author that this fails on your system:
remote:        npm ERR!     heroku-nextjs-build
remote:        npm ERR! You can get information on how to open an issue for this project with:
remote:        npm ERR!     npm bugs commandiv-next
remote:        npm ERR! Or if that isn't available, you can get their info via:
remote:        npm ERR!     npm owner ls commandiv-next
remote:        npm ERR! There is likely additional logging output above.
remote:
remote:        npm ERR! Please include the following file with any support request:
remote:        npm ERR!     /tmp/build_5d58160df57c635efb9f66645d150168/npm-debug.log
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !	Push rejected to commandiv-2.
remote:
To https://git.heroku.com/commandiv-2.git
 ! [remote rejected] master -> master (pre-receive hook declined)

Tried a few things, after reading this thread on npm, including using different versions of NPM...

Tried running with Yarn (including my yarn.lock file), that failed also, giving an error that my babel files couldn't be found. When I moved the babel preset packages from devDependencies to dependencies, I get the same error about the cross-device linking. No idea....

Maybe related to this PR - vercel/next.js#1174

yep, it was a bug that was introduced. I'm keeping fixed version numbers for next.js from now on.

mars commented

Interesting that this bug was found on a multi-device Windows filesystem. I hope that Next.js mv fix works for Heroku build too ⚔️