Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
33
rated 0 times [  35] [ 2]  / answers: 1 / hits: 62433  / 8 Years ago, tue, april 26, 2016, 12:00:00

I get the following error installing eslint:



npm ERR! Darwin 15.4.0
npm ERR! argv /usr/local/bin/node /usr/local/bin/npm install -g eslint
npm ERR! node v5.5.0
npm ERR! npm v3.8.8
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! 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! Please include the following file with any support request:
npm ERR! /Users/Leviathan/lj/npm-debug.log


I have not been able to figure out how to install eslint and also get this line:



eslint --init to run to create the .eslintrc file


More From » node.js

 Answers
6

It looks like you're trying to install globally while your user doesn't have access to the global node_modules folder. You can try installing it as root or chown '/usr/local/lib/node_modules'.



Install as root -



    sudo npm install -g eslint


Chown -



    chown user:group /usr/local/lib/node_modules
npm install -g eslint


You can also change permissions to /usr/local/lib/node_modules to allow your user access using chmod.



Edit:
Try the solution in the answer here
"Permission Denied" when trying to install ESlint on OSX globally



Add this to ~/.npmrc:



prefix = ${HOME}/.npm-packages
https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md
You also have to add ${HOME}/.npm-packages/.bin to your PATH so that your shell knows where to look up the globally installed scripts.


[#62399] Saturday, April 23, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ashli

Total Points: 210
Total Questions: 94
Total Answers: 96

Location: Austria
Member since Sat, Jul 24, 2021
3 Years ago
;