javascript - ESlint Error Install from Command Line

ID : 274468

viewed : 52

Tags : javascriptnode.jsterminaleslintjavascript





Top 5 Answer for javascript - ESlint Error Install from Command Line

vote vote

96

If you're getting eslint: command not found try:

./node_modules/.bin/eslint --init 
vote vote

88

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.

vote vote

77

Try

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

Let me know if you face any issues.

vote vote

68

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 
vote vote

51

I'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!

Top 3 video Explaining javascript - ESlint Error Install from Command Line







Related QUESTION?