1

I'm using nvm running node version 0.12.2.

I try and install bower globally:

karl@karl-laptop:~/www/busarama/src$ npm install -g bower
npm ERR! tar.unpack untar error /home/karl/.npm/bower/1.4.1/package.tgz
npm ERR! Linux 3.16.0-36-generic
npm ERR! argv "/home/karl/.nvm/versions/node/v0.12.2/bin/node" "/home/karl/.nvm/versions/node/v0.12.2/bin/npm" "install" "-g" "bower"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules',
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!    [ '/home/karl/.nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23',
npm ERR!      '/home/karl/.nvm/versions/node/v0.12.2/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:95:15)' ] }
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!     /home/karl/www/busarama/src/npm-debug.log

I am very suspicious it is due to me running this earlier today:

npm config set prefix /usr/local

Does anyone know what the default npm config prefix should be (when installing -g to the local profile, not sudo)? I installed nvm as a local user.

This is affecting everything I try to install globally.

Found this little nice link: https://docs.npmjs.com/files/folders

Local install (default): puts stuff in ./node_modules of the current package root.
Global install (with -g): puts stuff in /usr/local or wherever node is installed.
Install it locally if you're going to require() it.
Install it globally if you're going to run it on the command line.
If you need both, then install it in both places, or use npm link.
  • ...or wherever node is installed.

This means I'm guessing that it should be installed to /home/karl/.nvm/versions/node/v0.12.2 somewhere.

I need to set the npm config prefix to whatever node is running.

basickarl
  • 37,187
  • 64
  • 214
  • 335

1 Answers1

0

I just reinstalled nvm. Seemed to fix the config file.

basickarl
  • 37,187
  • 64
  • 214
  • 335