ESlint Error from the command line

I get the following error when 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 was not able to figure out how to install eslint, and also get the following line:

eslint - run to create .eslintrc file

+8
source share
5 answers

It looks like you are trying to install globally until your user has 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 the user access with 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 must also add $ {HOME} /. Npm-packages / .bin in your PATH so that your shell knows where to look for globally installed scripts.

+7
source

Try npm install eslint --save-dev and then eslint --init .

Let me know if you have any problems.

+1
source

I had eslint-bash permission denied, command not found . For me, the solution was:
1. find the installation path of eslint, for me it is:
# npm install -g eslint/root/mynode/node-v10.9.0-linux-x64/bin/eslint ->/root/mynode/node-v10.9.0-linux-x64/lib/node_modules/eslint/bin/eslint.js + eslint@5.6.0 updated 1 package in 5.114s path /root/mynode/node-v10.9.0-linux-x64/lib/node_modules/eslint/bin/eslint.js
2.run /root/mynode/node-v10.9.0-linux-x64/lib/node_modules/eslint/bin/eslint.js --init
Success!

0
source

eslint --init to run to create the.eslintrc file says: create.eslintrc, you probably forgot to enable it . before eslintrc

0
source

If you found this eslint: command not found because you get eslint: command not found , try:

 ./node_modules/.bin/eslint --init 
0
source

Source: https://habr.com/ru/post/1247929/


All Articles