Reputation: 6685
If I install ESLint globally I can use it, but if I uninstall the global ESLint and install it only inside the project folder with:
npm install eslint --save-dev
And then run eslint -v, it says command not found.
Do I need to install ESLint also globally if I want to use it only in my project?
Upvotes: 3
Views: 5272
Reputation: 2589
for me it works with npx
. so, commands will be something below (may be it will work for you with npm
)
npx eslint --fix
npx eslint . --ext .js,.jsx,.ts,.tsx
npx eslint --fix . --ext .js,.jsx,.ts,.tsx
Upvotes: 0
Reputation: 1925
To use it locally, ensure you have eslint installed:
npm install --save-dev eslint
The in your project folder run:
./node_modules/.bin/eslint --init
Upvotes: 1
Reputation: 944005
Installing it locally will install it under the node_modules
directory, which will not be in the PATH your system searches for executables.
Run it with npx
, which is distributed with recent versions of npm
.
npx eslint -v
Upvotes: 9
Reputation: 11
You only installed it locally, so you can only run it via ./node_modules/.bin/eslint -v
.
To install it globally do it like this: npm install --global esint --save-dev
. Maybe you need sudo/root rights.
Upvotes: 0