I just rebuilt the Mavericks machine (Mac OS X version 9.4) from scratch. I am the administrator and sole user of this machine.
- I installed Git through their
git-2.0.1-intel-universal-snow-leopard.pkg ( http://git-scm.com/downloads ) in my default location /usr/local/git/bin/git . - I installed Node through their
node-v0.10.30.pkg ( http://nodejs.org/download/ ) in my default location /usr/local/bin/node . - In the last step of the Node installation package, a note was added that they also installed NPM at their default location
/usr/local/bin/npm . - My
$PATH echo /usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin (it contains /usr/local/bin ).
Running npm install -g bower results in:
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower' npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/usr/local/lib/node_modules/bower', npm ERR! fstream_type: 'Directory', npm ERR! fstream_path: '/usr/local/lib/node_modules/bower', npm ERR! fstream_class: 'DirWriter', npm ERR! fstream_stack: npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23', npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53', npm ERR! 'Object.oncomplete (fs.js:107:15)' ] } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! System Darwin 13.3.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower" npm ERR! cwd /Users/Home npm ERR! node -v v0.10.30 npm ERR! npm -v 1.4.21 npm ERR! path /usr/local/lib/node_modules/bower npm ERR! fstream_path /usr/local/lib/node_modules/bower npm ERR! fstream_type Directory npm ERR! fstream_class DirWriter npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower' npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23 npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/Home/npm-debug.log npm ERR! not ok code 0
Running similar installations ( npm install -g yo , npm install -g grunt , npm install -g nvm , npm install -g npm ) leads to what seems to be the same list of errors.
Several people on the Internet offer to force installation through sudo , but some others warn that this may lead to later problems. The manuals for these packages do not seem to mention the sudo requirement, and in some cases they advise contacting NPM when this problem occurs.
Running npm cache clear does not fix the problem.
Running ls -la in the home directory ( ~ ) shows my Mac OS X username as the owner of my .npm directory: drwxr-xr-x 15 admin staff 510 Aug 11 23:53 .npm
Does anyone know what went wrong and how to fix it? Thanks.
jtheletter
source share