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.
I just reinstalled nvm. Seemed to fix the config file.
Related
i am trying to install bower version 1.8.2
globally on my Ubuntu 16.04
but it show that Missing write access /usr/local/bin
i have node 4.2.6
and npm 3.5.2
i get this error:
ubuntu#ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ npm install -g bower
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN checkPermissions Missing write access to /usr/local/lib
/usr/local/lib
`-- bower#1.8.2
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib' }
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/ubuntu/Desktop/Python-2.7.14/npm-debug.log
ubuntu#ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ node --version
v4.2.6
ubuntu#ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ npm --version
3.5.2
ubuntu#ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$
You can install it using sudo:
sudo npm i --global bower
But that is not recommended, hence you can fix your npm permissions like this:
sudo chown -R $(whoami) $(npm config get prefix)/lib/node_modules
You can find a gist for the same here.
I installed some nodejs packages globally via
sudo npm install gulp -g
Now I (or another developer on the same machine) wants to use it in a project with
me#host:/my/project$ npm link gulp
It fails with
unbuild gulp#3.8.11
npm ERR! Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js'
npm ERR! { [Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: '/my/projectnode_modules/gulp/bin/gulp.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.2.0-4-amd64
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "link" "gulp"
npm ERR! cwd /raid5/workspaces/jgr/aktivglueck-laravel
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! path /my/projectnode_modules/gulp/bin/gulp.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /my/projectnpm-debug.log
npm ERR! not ok code 0
With
sudo npm link gulp
everything works fine.
What I want to know is: Why does npm link need admin permissions? In my understanding I am creating a link inside my project folder where I have full permissions - so what does it do on the global system?
I believe npm link creates a symlink to the current directory in wherever your globally installed node packages are. See here.
If you don't have write rights to that path (you can check with npm config get prefix) you'll get the error you see there.
To avoid having to sudo global installs/links, you could change the ownership/rights of that directory.
I installed node and everything was ok, but when I've tried to install stylus, for example didn't allow me to do it with :nmp install -g stylus, only with :npm install stylus.
When I try to compile estilos.styl anywhere, then the console gives me
"command not found"
I tried to install stylus in the local folder too, but still same error. Same happens with grunt-cli or any module I try to install with node.
These are the errors:
iMac-de-Eva:~ eva$ npm install stylus -g npm ERR! Error: EACCES, mkdir
'/usr/local/lib/node_modules/stylus' npm ERR! { [Error: EACCES, mkdir
'/usr/local/lib/node_modules/stylus'] npm ERR! errno: 3, npm ERR!
code: 'EACCES', npm ERR! path: '/usr/local/lib/node_modules/stylus',
npm ERR! fstream_type: 'Directory', npm ERR! fstream_path:
'/usr/local/lib/node_modules/stylus', 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:46: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 12.5.0 npm ERR! command "node"
"/usr/local/bin/npm" "install" "stylus" "-g" npm ERR! cwd /Users/eva
npm ERR! node -v v0.10.33 npm ERR! npm -v 1.4.28 npm ERR! path
/usr/local/lib/node_modules/stylus npm ERR! fstream_path
/usr/local/lib/node_modules/stylus 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/stylus'
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:46: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/eva/npm-debug.log npm ERR! not ok code 0
If you're trying to install globally (which is what the -g switch means) you may have to use sudo: sudo npm install -g [module-name]
EACASSS error means you do not have permissions.
To install globally you need to have elevated permissions, this will help:
sudo npm install -g stylus
It will ask you for the password for security reasons.
Installing locally works without permissions, but as you noticed, command stylus is not found, because it is installed locally and not included into your $PATH.
Try to install using this:
npm install --save [module-name]
I'm just trying to install nodemon or supervisor using terminal, and I keep getting this error which I don't understand. I tried running as the administrator with sudo npm install supervisor -g which seemed to work, but than didn't when i deleted/added some js code. Any ideas?
Squirrels-MacBook-Air:lesson7_examples Squirrel$ npm install nodemon -g
npm http GET https://registry.npmjs.org/nodemon
npm http 304 https://registry.npmjs.org/nodemon
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/nodemon'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/nodemon']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/nodemon',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/nodemon',
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 12.4.1
npm ERR! command "node" "/usr/local/bin/npm" "install" "nodemon" "-g"
npm ERR! cwd /Users/Squirrel/Documents/Code/Memry/Memry_Mongoose
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! path /usr/local/lib/node_modules/nodemon
npm ERR! fstream_path /usr/local/lib/node_modules/nodemon
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/nodemon'
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/Squirrel/Documents/Code/Memry/Memry_Mongoose/npm-debug.log
npm ERR! not ok code 0
Squirrels-MacBook-Air:lesson7_examples Squirrel$
P.S. I'm running this on a pre-existing template and my dependencies are
"dependencies": {
"mongoose": "~3.6.15",
"express": "~3.3.4",
"jade": "~0.34.1",
"email-validator": "~0.1.2"
}
When I tried sudo this is what happened:
sudo npm install supervisor -g --save
Password:
npm http GET https://registry.npmjs.org/supervisor
npm http 304 https://registry.npmjs.org/supervisor
/usr/local/bin/node-supervisor -> /usr/local/lib/node_modules/supervisor/lib/cli-wrapper.js
/usr/local/bin/supervisor -> /usr/local/lib/node_modules/supervisor/lib/cli-wrapper.js
supervisor#0.5.6 /usr/local/lib/node_modules/supervisor
Which seemed to work. But than in the application code I began to add and delete javascript and click save, yet the effects wouldn't take place unless I restarted the server within terminal.
Late to the party, but it is important to note that you should avoid using sudo when npm installing. It is a huge security risk to sudo npm install as you are giving arbitrary scripts root access to your machine.
Instead you should make yourself the owner of the directories in which the NPM
sudo chown -R $USER /usr/local
and then
sudo chown -R $USER ~/.npm
Now you should be able to run the commands without sudo:
npm install supervisor -g --save
You're encountering an EACCES error, which means you don't have the rights to create a directory in /usr/local/lib/node_modules/nodemon as a standard user in Mac OS X.
There are two solutions:
Run the same command as a superuser, using sudo. The package will be installed in /usr/local/lib/node_modules.
Change npm's settings to install all of your global packages into one of your private folders, that your user has ownership of. See this relevant answer that explains step-by-step the process.
I know I'm late to the question, but you should check out nvm (node's answer to rbenv or virtualenv).
Install:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
Then add . ~/.nvm/nvm.sh to your ~/.bashrc, ~/.profile, or ~/.zshrc
Usage:
If you wanted to use version 0.10, run nvm install 0.12.7 (or nvm install stable), then nvm use 0.12.7.
Install your libs, EACCESS error-free, and go to town. npm install -g supervisor works just fine!
To load a specific version default in new tabs, use the command nvm alias default 0.12.7
I already have installed express using
npm install express
but looks like in order too create apps I should install it globally. So I used:
npm install -g express
but received:
npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/express'
npm ERR! { [Error: EACCES, mkdir '/usr/lib/node_modules/express']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/lib/node_modules/express',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/lib/node_modules/express',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/lib/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/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 Linux 3.11.2-201.fc19.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "express"
npm ERR! cwd /home/parisa
npm ERR! node -v v0.10.19
npm ERR! npm -v 1.3.6
npm ERR! path /usr/lib/node_modules/express
npm ERR! fstream_path /usr/lib/node_modules/express
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/lib/node_modules/express'
npm ERR! fstream_stack /usr/lib/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/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! /home/parisa/npm-debug.log
npm ERR! not ok code 0
then after trying sudo:
sudo npm install -g express
I get this:
axconfig: unable to open axports file /etc/ax25/axports (No such file or directory)
why is that???
As the error clearly states, you don't have permissions to create in /usr/lib.
stack Error: EACCES, mkdir '/usr/lib/node_modules/express'
hence install with sudo permissions..
sudo npm install -g express
Are you using fedora?
At least in fedora the "node" package is not node.js, It is an amateur radio utility,
axconfig is a file of that software.
npm is not finding nodejs, it is trying to use the wrong software.
Install nodejs package
sudo yum install nodejs
and remove node package
sudo yum remove node
Now npm must work properly for the super user.
edit: Also in debian repositories, the package 'node' is not nodejs
If you are on Arch Linux, check out the npm2arch package in the AUR. It will let you install npm packages using pacman.
Example:
npm2archinstall express