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
There are three ways that ESLint fix can be run: eslint --fix. eslint --fix-dry-run. eslint --fix --fix-type.
Note: npm init @eslint/config assumes you have a package. json file already. If you don't, make sure to run npm init or yarn init beforehand. It is also possible to install ESLint globally rather than locally (using npm install eslint --global ).
If you haven't installed ESLint either locally or globally do so by running npm install eslint in the workspace folder for a local install or npm install -g eslint for a global install. On new folders you might also need to create a . eslintrc configuration file.
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.
If you're getting eslint: command not found
try:
./node_modules/.bin/eslint --init
Try
npm install eslint --save-dev
and then eslint --init
.
Let me know if you face any issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With