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
17 Answers
If you're getting eslint: command not found try:
./node_modules/.bin/eslint --init 1It 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 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.
4Try
npm install eslint --save-dev and then eslint --init.
Let me know if you face any issues.
2I've had eslint-bash permission denied, command not found too. For me the solution was :
1. find the install 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 The path is /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!
May be updating the dependencies to their latest versions (including major version changes) in the package.json file. would save you time.
npx npm-check-updates -u or you may have to install eslint globally.
npm i eslint -g and after removing node modules of your current project
eslint --init For: Zsh: command not found: eslint
npm install eslint-plugin-react-hooks --save --dev then run:
npm install -g eslint It should work
eslint --init to run to create the .eslintrc file is says create .eslintrc, you probably forgot to include . before eslintrc