The npm install on wrong directory
sudo npm install sharp
> [email protected] install /home/pi/node_modules/sharp
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/node_modules/sharp/.node-gyp"
should be /usr/local/lib/nod_modules/sharp/
and /usr/local/bin for node_modules/.bin
Bonjour, if you need to use sudo then you'll also need to add the --unsafe-perm flag to npm so it grants node-gyp the root-level access it will require - see https://github.com/nodejs/node-gyp/issues/454
Thanks for your help
It's working fine with
sudo npm install --unsafe-perm -g sharp
I am facing the same issue but in windows. How to resolve it?
what is the equivalent command for doing the same in windows
sudo npm install --unsafe-perm -g sharp
@emmtte @lovell
please help.
Most helpful comment
Thanks for your help
It's working fine with
sudo npm install --unsafe-perm -g sharp