user1460904
user1460904

Reputation: 413

How to install node-gyp in Linux?

user@user-VirtualBox:~/express$ npm install -g node-gyp
npm http GET https://registry.npmjs.org/node-gyp
npm http 200 https://registry.npmjs.org/node-gyp
npm http GET https://registry.npmjs.org/node-gyp/-/node-gyp-0.6.3.tgz
npm http 200 https://registry.npmjs.org/node-gyp/-/node-gyp-0.6.3.tgz
npm ERR! Could not create /usr/local/lib/node_modules/___node-gyp.npm
npm ERR! error installing [email protected]

npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules'
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! 
npm ERR! System Linux 3.2.0-23-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "node-gyp"
npm ERR! cwd /home/user/express
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules'
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/user/express/npm-debug.log
npm not ok
user@user-VirtualBox:~/express$ 

What I am trying is install Node-gyp on a system. I tried to install on system that have linux 12.04 ubuntu OS.

Do someone know how to set permission for installing node-gyp.

Thanks for help.

Upvotes: 20

Views: 56149

Answers (4)

JHM16
JHM16

Reputation: 798

You Can Try this

sudo npm install -g node-gyp --allow-root --unsafe-perm

Upvotes: -1

I've had luck switching to the root user (sudo su, --> password), and then running: sudo npm install -g node-gyp And then you can press Ctrl+D to return to the normal user (i.e., You).

This might help.

[[EDIT]]: Node-Gyp doesn't support Python 3: https://github.com/nodejs/node-gyp/issues/1337

I have no idea why, since Python 3.0.0 was realeased almost 10 years ago.

Upvotes: -2

Professor
Professor

Reputation: 2154

you need administrator rights to install it

try

sudo -i

npm install -g node-gyp

Upvotes: -1

phihag
phihag

Reputation: 288190

npm install -g installs a package for all users. Therefore, you need administrator rights to install it. Try

sudo npm install -g node-gyp

Upvotes: 35

Related Questions