Naim Rajiv
Naim Rajiv

Reputation: 3374

npm install need root/Administrator

I am facing this error during running npm install command.

npm ERR! Linux 3.13.0-63-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path /media/DOCUMENT/plugin/node_modules/pg/node_modules/.bin/semver
npm ERR! code EPERM
npm ERR! errno -1

npm ERR! Error: EPERM, symlink '/media/DOCUMENT/plugin/node_modules/pg/node_modules/.bin/semver'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM, symlink '/media/DOCUMENT/plugin/node_modules/pg/node_modules/.bin/semver']
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   path: '/media/DOCUMENT/plugin/node_modules/pg/node_modules/.bin/semver' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

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

Please suggest me, how i can fix this issue. I tried some solution but no luck. FYI, I tried by using sudo npm install and this didn't solve the issue.

Update: This works fine when the main code base resides in the home directory. Now everything working fine after put the project under the home directory of the user!

Thanks

Upvotes: 2

Views: 4675

Answers (2)

shan1024
shan1024

Reputation: 1399

You need to use -g flag to globally install packages.

Ex: npm install semver -g

But to globally install packages, you need elevated privileges. So you have to use sudo command.

Ex: sudo npm install semver -g

Upvotes: 1

Dan Keiger
Dan Keiger

Reputation: 671

You'll want to run as admin. Use sudo npm install

Upvotes: 1

Related Questions