Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using the latest version of stable node.js (0.8.19)

$cd ~/downloads/node
$./configure
$make
$sudo make install

Doing this installed node.js

Now, when I go to:

$cd ~/myproject/node_modules
$npm install express
npm ERR! Error: EACCES, open '/home/user/.npm/64a534c1-express.lock'
npm ERR!  { [Error: EACCES, open '/home/user/.npm/64a534c1-express.lock']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/user/.npm/64a534c1-express.lock' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.5.0-17-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "express"
npm ERR! cwd /home/user/myproject/src
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! path /home/user/.npm/64a534c1-express.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/home/user/.npm/64a534c1-express.lock'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/user/myproject/src/npm-debug.log
npm ERR! not ok code 0

See? for some reason I cannot install npm as a local user. However, when I use sudo npm install express, everything works.

share|improve this question
    
I don't understand your issue, once installed, you should be ok. –  mdpc Feb 15 '13 at 7:31
    
Check your permissions. I'd bet /home/user/.npm/ or something in it is owned root rather than "user". –  ceejayoz Mar 18 '13 at 20:55

1 Answer 1

I don't have an exact answer for you but a solution to allow you to install the module without running sudo is to make sure the directory you are working in contains a node_modules directory.

# ~ cd myproject
# ~/myproject mkdir node_modules
# ~/myproject npm install express

Notice how npm is being ran outside of the node_modules directory, one level up.

share|improve this answer
    
The problem is that express provides a nice binary helper, which you can not use (well, you can but you end up typing a butt tonne of characters) without installing with -g. on linux if you use -g then it tries to install to /usr/share/node_modules or somet root owned place. –  airtonix Dec 29 '13 at 7:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.