Andre Maia
Andre Maia

Reputation: 152

npm Error: EACCES: permission denied when I try local install karma

I need locally install karma The command to do that is this:

npm install karma

But it gives me an EACCES error:

npm ERR! Linux 4.2.0-34-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "karma" "--save-dev"
npm ERR! node v6.0.0
npm ERR! npm  v4.0.5
npm ERR! path ../mime/cli.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink

npm ERR! Error: EACCES: permission denied, symlink '../mime/cli.js' -> '/home/andre/py/divvy/node_modules/.bin/mime'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, symlink '../mime/cli.js' -> '/home/andre/py/divvy/node_modules/.bin/mime'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../mime/cli.js',
npm ERR!   dest: '/home/andre/py/divvy/node_modules/.bin/mime' }
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/andre/py/divvy/npm-debug.log

If I use sudo it works, but I cannot use sudo to install local npm packages

I am using ubuntu 15 and npm 4.0.5

Upvotes: 0

Views: 2155

Answers (1)

Vasista TVN
Vasista TVN

Reputation: 385

create a directory for global installations:

mkdir ~/.npm-global

Configure npm to use the new directory path:

npm config set prefix '~/.npm-global'

In your preferred text editor, open or create a

~/.profile

file and add this line:

export PATH=~/.npm-global/bin:$PATH

On the command line, update your system variables:

source ~/.profile

To test your new configuration, install a package globally without using sudo

Upvotes: 1

Related Questions