Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

npm - 'eslint' is not recognized as an internal or external command

I'm trying to install eslint & run it in vs code. I ran this command:

npm i -g eslint

and it seemed to work, but I keep getting a "'eslint' is not recognized as an internal or external command" error when I try & run eslint. What gives?

http://eslint.org/docs/user-guide/command-line-interface

http://eslint.org/docs/user-guide/getting-started

question from:https://stackoverflow.com/questions/37705440/eslint-is-not-recognized-as-an-internal-or-external-command

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The eslint module must not be installed into global.

instead, you should install eslint-cli module into global.

So, first install eslint-cli gloablly:

npm -g i eslint-cli

then in the project folder: install eslint locally

npm i eslint --save-dev

Then in the project folder you can run someting like: (on Windows)

eslint .

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...