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.
Related
I am using mac terminal to access my amazon ec2 free tier. I installed node and npm using commands.
but when I tried to install Coffee-Script using below command, it gives error and warnings. I don't know what to do. Please help me.
[ec2-user#ip-xxx-xx-xx-xxx /]$ npm install -g coffee-script
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── coffee-script#1.10.0
npm ERR! Linux 4.4.11-23.53.amzn1.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 4.4.11-23.53.amzn1.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! path npm-debug.log.3173130556
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.3173130556'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, open 'npm-debug.log.3173130556'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: 'npm-debug.log.3173130556' }
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! /npm-debug.log
Also I tried :
[ec2-user#ip-xxx-xx-xx-xx /]$ sudo npm install -g coffee-script
sudo: npm: command not found
Your NPM installation is in a privileged space forcing you to use sudo to make any changes. The problem, is that you're PATH isn't being passed to the sudo'd shell.
You can modify the sudoers PATH by editing the secure_path field in /etc/sudoers.
If you just want to get it installed, provide the full path to npm.
sudo $(which npm) install -g coffee-script
I get this code. I am on a Mac. I have installed npm. I am an Admin. What am I doing wrong? I've been googling for hours.
Matts-MacBook-Pro-3:Start Matt$ npm install express-generator -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/express-generator
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── express-generator#4.13.1
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "express-generator" "-g"
npm ERR! node v5.3.0
npm ERR! npm v3.3.12
npm ERR! path /usr/local/lib/node_modules/express-generator
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/express-generator'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/express-generator']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/express-generator' }
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! /Users/Matt/Start/Start/npm-debug.log
Matts-MacBook-Pro-3:Start Matt$
Try clearing the npm cache and try the npm install again. You can use the following to clear the npm cache.
npm cache clean <path to express-generator>
Sometimes you get this error even when you are on ssh, the npm registry might be configured to use a different registry for npm packages and that registry might not have a express-generator
So I installed Node.js by downloading the mac 0Sx package from their website, but now every time I try to run a command such as f$ grunt-cli -v I get the following error below. This path /usr/local/bin/npm also doesn't exist on my computer, and I don't know how to find node.js to unistall it, and then re-install it using homebrew. Let me know if I have left any info out.
-bash: grunt-cli: command not found
Sams-MacBook-Pro:~ SamDavidoff$ npm install -g grunt-cli
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! path /usr/local/lib/node_modules/grunt-cli
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/grunt-cli' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/grunt-cli' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/SamDavidoff/npm-debug.log
EACCES means you don't have root access. Reinstalling node/npm won't help. Like it says, try running it as admin:
sudo npm install -g grunt-cli
Or if you don't want to use sudo, install nvm (note nvm may not allow you to globally install on mac, but it does on ubuntu so it might work):
$ git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
$ ...
$ ~/.nvm/nvm.sh
$ ...
$ nvm install stable
$ ...
$ nvm use stable
$ npm install -g grunt-cli
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.
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