Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Cloud Functions - EXDEV: cross-device link not permitted - v0.20.6 #1345

Closed
amitbravo opened this issue Aug 20, 2018 · 17 comments
Closed

Comments

@amitbravo
Copy link

amitbravo commented Aug 20, 2018

npm ERR! Linux 4.4.0-133-generic
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "--global-style" "--production" "--fetch-retries=5" "--fetch-retry-factor=2" "--fetch-retry-mintimeout=1000" "install" "/workspace"
npm ERR! node v6.14.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script '(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sharp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sharp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sharp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /workspace/npm-debug.log

Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions

Error: Functions did not deploy properly.

==============
I did brew upgrade npm , result = npm 10.9.0 already installed

Package.json

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase serve --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "@google-cloud/storage": "^1.7.0",
    "@google-cloud/vision": "^0.21.0",
    "firebase-admin": "^6.0.0",
    "firebase-functions": "^2.0.4",
    "lodash": "^4.17.10",
    "path": "^0.12.7",
    "request-promise": "^4.2.2",
    "sendotp": "^1.2.9",
    "sharp": "^0.20.6"
  },
  "private": true
}
@lovell
Copy link
Owner

lovell commented Aug 20, 2018

Hello, was this as a result of having just upgraded from sharp v0.20.5 to v0.20.6?

@lovell lovell added the triage label Aug 20, 2018
@amitbravo
Copy link
Author

yes, I had similar error even when I downgraded it to my local project to 0.20.5

@balazsorban44
Copy link

Getting the same error! I actually got it before I updated to v0.20.6, but only today, so there must be a relation.

@lovell
Copy link
Owner

lovell commented Aug 20, 2018

Please can you run firebase deploy with the --verbose or --debug flag to get more information, or provide the relevant contents of the quoted /workspace/npm-debug.log file.

@amitbravo
Copy link
Author

meanwhile I tried to use sudo npm install sharp and sudo npm install libvips , libvips was installed as /Users/myname/node_module but not sharp , it got somewhat this error while installing

> [email protected] install /Users/myname/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /Users/myname/.npm/_libvips/libvips-8.6.1-darwin-x64.tar.gz
ERR! sharp EACCES: permission denied, mkdir '/Users/myname/node_modules/sharp/vendor'
ERR! sharp Please see http://sharp.pixelplumbing.com/page/install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/myname/node_modules/sharp/build'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/myname/node_modules/sharp
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/Users/myname/package.json'
npm WARN myname No description
npm WARN myname No repository field.
npm WARN myname No README data
npm WARN myname No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/myname/.npm/_logs/2018-08-20T12_25_49_222Z-debug.log
mynames-MacBook-Pro:~ myname$ 

and now when I use firebase deploy , it completely crash as

npm ERR! path /Users/myname/.npm/_logs/2017-11-06T09_32_59_087Z-debug.log
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall unlink
npm ERR! Error: EACCES: permission denied, unlink '/Users/myname/.npm/_logs/2017-11-06T09_32_59_087Z-debug.log'
npm ERR!     at Object.unlinkSync (fs.js:916:3)
npm ERR!     at Function.rimrafSync [as sync] (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:306:17)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/npm.js:336:20
npm ERR!     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
npm ERR!     at Glob.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:151:7)
npm ERR!     at Glob.emit (events.js:182:13)
npm ERR!     at Glob._finish (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:197:8)
npm ERR!     at done (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:182:14)
npm ERR!     at Glob._processReaddir2 (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:434:12)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:371:17
npm ERR!     at RES (/usr/local/lib/node_modules/npm/node_modules/inflight/inflight.js:31:16)
npm ERR!     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
npm ERR!     at Glob._readdirEntries (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:578:10)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:555:12
npm ERR!     at go$readdir$cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:149:14)
npm ERR!     at FSReqWrap.oncomplete (fs.js:139:20)
npm ERR!  { Error: EACCES: permission denied, unlink '/Users/myname/.npm/_logs/2017-11-06T09_32_59_087Z-debug.log'
npm ERR!     at Object.unlinkSync (fs.js:916:3)
npm ERR!     at Function.rimrafSync [as sync] (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:306:17)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/npm.js:336:20
npm ERR!     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
npm ERR!     at Glob.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:151:7)
npm ERR!     at Glob.emit (events.js:182:13)
npm ERR!     at Glob._finish (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:197:8)
npm ERR!     at done (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:182:14)
npm ERR!     at Glob._processReaddir2 (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:434:12)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:371:17
npm ERR!     at RES (/usr/local/lib/node_modules/npm/node_modules/inflight/inflight.js:31:16)
npm ERR!     at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
npm ERR!     at Glob._readdirEntries (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:578:10)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:555:12
npm ERR!     at go$readdir$cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:149:14)
npm ERR!     at FSReqWrap.oncomplete (fs.js:139:20)
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, unlink \'/Users/myname/.npm/_logs/2017-11-06T09_32_59_087Z-debug.log\'\n    at Object.unlinkSync (fs.js:916:3)\n    at Function.rimrafSync [as sync] (/usr/local/lib/node_modules/npm/node_modules/rimraf/rimraf.js:306:17)\n    at /usr/local/lib/node_modules/npm/lib/npm.js:336:20\n    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)\n    at Glob.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:151:7)\n    at Glob.emit (events.js:182:13)\n    at Glob._finish (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:197:8)\n    at done (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:182:14)\n    at Glob._processReaddir2 (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:434:12)\n    at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:371:17\n    at RES (/usr/local/lib/node_modules/npm/node_modules/inflight/inflight.js:31:16)\n    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)\n    at Glob._readdirEntries (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:578:10)\n    at /usr/local/lib/node_modules/npm/node_modules/glob/glob.js:555:12\n    at go$readdir$cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:149:14)\n    at FSReqWrap.oncomplete (fs.js:139:20)',
npm ERR!   errno: -13,
npm ERR!   syscall: 'unlink',
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/myname/.npm/_logs/2017-11-06T09_32_59_087Z-debug.log' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! Callback called more than once.

Error: An unexpected error has occurred.

Having trouble? Try again or contact support with contents of firebase-debug.log
mynames-MacBook-Pro:functions myname$ 

@ovaris
Copy link

ovaris commented Aug 20, 2018

Started to happen for me as well (in Firebase environment):

Build failed: USER ERROR:
`npm_install` had stderr output:
node-pre-gyp WARN Using request for node-pre-gyp https download 
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-linux-x64.tar.gz
fs.js:766
  return binding.rename(pathModule._makeLong(oldPath),

Error: EXDEV: cross-device link not permitted, rename '/workspace/node_modules/sharp/122-libvips-8.6.1-linux-x64.tar.gz' -> '/builder/home/.npm/_libvips/libvips-8.6.1-linux-x64.tar.gz'

@lovell
Copy link
Owner

lovell commented Aug 20, 2018

@ovaris Thank you. EXDEV: cross-device link not permitted is the underlying error, which reveals that Google Cloud Functions stores your npm cache /builder/home/.npm on a different device/partition to your /workspace/node_modules.

The logic introduced by #1301 will probably have to change to use copy-and-unlink rather than just renaming to deal with device/partition boundaries.

@amitbravo Avoid sudo if possible. If absolutely required then add the npm install --unsafe-perm flag.

@lovell lovell changed the title Cloud function fail to update node-gyp rebuild && node install/dll-copy Google Cloud Functions - EXDEV: cross-device link not permitted - v0.20.6 Aug 20, 2018
@ovaris
Copy link

ovaris commented Aug 20, 2018

Thx @lovell for info. I will downgrade to v0.20.5 for now.

@amitbravo
Copy link
Author

@lovell should I remove /Users/myusername/node_module ?

@lovell lovell added bug and removed triage labels Aug 20, 2018
@lovell lovell added this to the v0.20.7 milestone Aug 20, 2018
@itaydressler
Copy link

Also experiencing this issue bot on v0.20.5 and v0.20.6 .
Using the new node 8 environment on google cloud functions.

Logs:

⚠ functions[memberPayments(us-central1)]: Deployment error.
Build failed: USER ERROR:
npm_install had stderr output:
node-pre-gyp WARN Using request for node-pre-gyp https download
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-linux-x64.tar.gz
fs.js:766
return binding.rename(pathModule._makeLong(oldPath),
^

Error: EXDEV: cross-device link not permitted, rename '/workspace/node_modules/sharp/30-libvips-8.6.1-linux-x64.tar.gz' -> '/builder/home/.npm/_libvips/libvips-8.6.1-linux-x64.tar.gz'
at Object.fs.renameSync (fs.js:766:18)
at WriteStream. (/workspace/node_modules/sharp/install/libvips.js:85:12)
at emitNone (events.js:106:13)
at WriteStream.emit (events.js:208:7)
at fs.close (fs.js:2087:12)
at FSReqWrap.oncomplete (fs.js:135:15)
../src/common.cc:25:10: fatal error: vips/vips8: No such file or directory
#include <vips/vips8>
^~~~~~~~~~~~
compilation terminated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-133-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /workspace/node_modules/sharp
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of firebase-admin@~6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /builder/home/.npm/_logs/2018-08-20T15_43_50_672Z-debug.log

error: npm_install returned code: 1

Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions

@ovaris
Copy link

ovaris commented Aug 20, 2018

@itaydressler make sure you have defined exact version in package.json

@itaydressler
Copy link

🤦🏼‍♂️
Thanks!

@fabiomirandaa
Copy link

I have the same problem

@fabiomirandaa
Copy link


> [email protected] install /workspace/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-linux-x64.tar.gz
fs.js:819
  return binding.rename(pathModule._makeLong(oldPath),
                 ^

Error: EXDEV: cross-device link not permitted, rename '/workspace/node_modules/sharp/72-libvips-8.6.1-linux-x64.tar.gz' -> '/builder/home/.npm/_libvips/libvips-8.6.1-linux-x64.tar.gz'
    at Error (native)
    at Object.fs.renameSync (fs.js:819:18)
    at WriteStream.<anonymous> (/workspace/node_modules/sharp/install/libvips.js:85:12)
    at emitNone (events.js:86:13)
    at WriteStream.emit (events.js:185:7)
    at fs.js:2060:14
    at FSReqWrap.oncomplete (fs.js:123:15)
make: Entering directory '/workspace/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:25:22: fatal error: vips/vips8: No such file or directory
 #include <vips/vips8>
                      ^
compilation terminated.
sharp.target.mk:119: recipe for target 'Release/obj.target/sharp/src/common.o' failed
make: *** [Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/workspace/node_modules/sharp/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Linux 4.4.0-133-generic
gyp ERR! command "/nodejs/bin/node" "/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /workspace/node_modules/sharp
gyp ERR! node -v v6.14.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
[email protected] /workspace
+-- @fnando/[email protected]  (git+https://github.com/raphaklaus/cpf.git#0b90814581a9f2bd947c5b9dade59e5c1fc518c7)
+-- UNMET PEER DEPENDENCY aws-sdk@^2.138.0
+-- UNMET PEER DEPENDENCY elasticsearch@^13.2.0
`-- [email protected] 

npm WARN [email protected] requires a peer of aws-sdk@^2.138.0 but none was installed.
npm WARN [email protected] requires a peer of elasticsearch@^13.2.0 but none was installed.
npm ERR! Linux 4.4.0-133-generic
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "--global-style" "--production" "--fetch-retries=5" "--fetch-retry-factor=2" "--fetch-retry-mintimeout=1000" "install" "/workspace"
npm ERR! node v6.14.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script '(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sharp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sharp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sharp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /workspace/npm-debug.log

@lovell
Copy link
Owner

lovell commented Aug 20, 2018

Thanks for all the examples, the underlying problem should be fixed by commit ece1112.

I plan to publish this in v0.20.7 tomorrow unless any other problems with v0.20.6 arise in the meantime.

For now, the workaround for users of both sharp and Google Cloud Functions is to pin sharp to v0.20.5.

@dwjohnston
Copy link

I am so glad this thread exists. :'D

@lovell
Copy link
Owner

lovell commented Aug 21, 2018

v0.20.7 is now available and it's worth upgrading as the caching in this new version should reduce re-installation times by ~5 seconds.

If you've added a 👍 to this issue and have not already contributed to the survey, it's always great to learn more about what people are using sharp for if you're able to share details publicly - please see #35.

@lovell lovell closed this as completed Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants