question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vagrant, sudo/root: node-gyp rebuild fails with EACCES

See original GitHub issue

Hi, I can’t install sharp package for my app. I have Node.js v6.11.0, gcc 5.4.0, node-gyp 3.6.2. Also I’m using Vagrant. I can install all other packages, but not sharp. It seems that something wrong with permissions, but I don’t know how to fix this issue. Please help me.

user@node3-vm:/vagrant$ sudo npm i sharp
> sharp@0.18.1 install /vagrant/node_modules/sharp
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/vagrant/node_modules/sharp/build'
gyp ERR! stack     at Error (native)
gyp ERR! System Linux 4.4.0-51-generic
gyp ERR! command "/home/user/.nvm/versions/node/v6.11.0/bin/node" "/home/user/.nvm/versions/node/v6.11.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /vagrant/node_modules/sharp
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm ERR! Linux 4.4.0-51-generic
npm ERR! argv "/home/user/.nvm/versions/node/v6.11.0/bin/node" "/home/user/.nvm/versions/node/v6.11.0/bin/npm" "i" "sharp"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! sharp@0.18.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.18.1 install script 'node-gyp rebuild'.
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-gyp rebuild
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!     /vagrant/npm-debug.log

npm-debug.log:

...
3189 silly lifecycle tar@3.1.5~install: no script for install, continuing
3190 silly install sharp@0.18.1 /vagrant/node_modules/.staging/sharp-9f6bc15c
3191 info lifecycle sharp@0.18.1~install: sharp@0.18.1
3192 verbose lifecycle sharp@0.18.1~install: unsafe-perm in lifecycle false
3193 verbose lifecycle sharp@0.18.1~install: PATH: /home/user/.nvm/versions/node/v6.11.0/lib/node_modules/npm/bin/node-gyp-bin:/vagrant/node_modules/sharp/node_modules/.bin:/vagrant/node_modules/.bin:/home/user/.nvm/versions/node/v6.11.0/bin:/home/user/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
3194 verbose lifecycle sharp@0.18.1~install: CWD: /vagrant/node_modules/sharp
3195 silly lifecycle sharp@0.18.1~install: Args: [ '-c', 'node-gyp rebuild' ]
3196 silly lifecycle sharp@0.18.1~install: Returned: code: 1  signal: null
3197 info lifecycle sharp@0.18.1~install: Failed to exec install script
3198 verbose unlock done using /home/user/.npm/_locks/staging-db29c5a769436947.lock for /vagrant/node_modules/.staging
3199 silly rollbackFailedOptional Starting
3200 silly rollbackFailedOptional Finishing
3201 silly runTopLevelLifecycles Finishing
3202 silly install printInstalled
3203 verbose stack Error: sharp@0.18.1 install: `node-gyp rebuild`
3203 verbose stack Exit status 1
3203 verbose stack     at EventEmitter.<anonymous> (/home/user/.nvm/versions/node/v6.11.0/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
3203 verbose stack     at emitTwo (events.js:106:13)
3203 verbose stack     at EventEmitter.emit (events.js:191:7)
3203 verbose stack     at ChildProcess.<anonymous> (/home/user/.nvm/versions/node/v6.11.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
3203 verbose stack     at emitTwo (events.js:106:13)
3203 verbose stack     at ChildProcess.emit (events.js:191:7)
3203 verbose stack     at maybeClose (internal/child_process.js:891:16)
3203 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
3204 verbose pkgid sharp@0.18.1
3205 verbose cwd /vagrant
3206 error Linux 4.4.0-51-generic
3207 error argv "/home/user/.nvm/versions/node/v6.11.0/bin/node" "/home/user/.nvm/versions/node/v6.11.0/bin/npm" "i" "sharp"
3208 error node v6.11.0
3209 error npm  v3.10.10
3210 error code ELIFECYCLE
3211 error sharp@0.18.1 install: `node-gyp rebuild`
3211 error Exit status 1
3212 error Failed at the sharp@0.18.1 install script 'node-gyp rebuild'.
3212 error Make sure you have the latest version of node.js and npm installed.
3212 error If you do, this is most likely a problem with the sharp package,
3212 error not with npm itself.
3212 error Tell the author that this fails on your system:
3212 error     node-gyp rebuild
3212 error You can get information on how to open an issue for this project with:
3212 error     npm bugs sharp
3212 error Or if that isn't available, you can get their info via:
3212 error     npm owner ls sharp
3212 error There is likely additional logging output above.
3213 verbose exit [ 1, true ]

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, Jun 25, 2017

Hello, npm’s --unsafe-perm flag usually “solves” most file permission problems when using sudo/root. https://docs.npmjs.com/misc/config#unsafe-perm

0reactions
lovellcommented, Sep 20, 2017

@hsribei But good luck sorting this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why I got an error at "node-gyp rebuild" at Win10?
I got a problem when running node-gyp rebuild . Run it as administrator has the same problem. Please help me to fix it....
Read more >
VirtualBox - Look on my works, ye Mighty, and despair!
Error building node module in a Vagrant box with NFS ... A github issue suggested that cloning the repo, and running node-gyp rebuild,...
Read more >
Trouble performing npm install in Basic Gulp Housekeeping
Error : EACCES, mkdir '/home/vagrant/.npm/laravel-elixir/3.3.4' npm ERR! ... node-gyp rebuild make: Entering directory `/home/vagrant/Projects/project-flyer/ ...
Read more >
gyp ERR! stack Error: EACCES: permission denied
gyp ERR! configure error gyp ERR! stack Error: EACCES: permission ... sudo rm -rf ~/.node-gyp sudo npm cache clean -f sudo npm install...
Read more >
Npm install command failing with message "could not find ...
... command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found