'eslint'不被识别为内部或外部命令 [英] 'eslint' is not recognized as an internal or external command

查看:2118
本文介绍了'eslint'不被识别为内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装eslint&在vs代码中运行它.我运行了以下命令:

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

npm i -g eslint

似乎有效,但是在尝试&时,我一直不断收到'eslint'未被识别为内部或外部命令"错误.运行埃斯林特.有什么作用?

and it seemed to work, but I keep 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-线路界面

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

推荐答案

eslint模块必须安装到全局中.

The eslint module must not be installed into global.

相反,您应该将eslint-cli模块安装到全局中.

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

因此,请首先轻松安装 eslint-cli :

So, first install eslint-cli gloablly:

npm -g i eslint-cli

然后在项目文件夹中:在本地安装 eslint

then in the project folder: install eslint locally

npm i eslint --save-dev

然后在项目文件夹中可以运行以下命令:(在Windows上)

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

eslint .\

这篇关于'eslint'不被识别为内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆