简体   繁体   English

找不到模块“babel-eslint”(标准和 babel-eslint 都已在本地安装)

[英]Cannot find module 'babel-eslint' (both standard and babel-eslint already installed locally)

What version of standard?什么版本的标准?

12.0.1 12.0.1

What operating system, Node.js, and npm version?什么操作系统、Node.js 和 npm 版本?

Windows 10, Node v10.15.1, NPM v.6.8.0 Windows 10,节点 v10.15.1,NPM v.6.8.0

What did you expect to happen?你期望会发生什么?

  • I install both standard and babel-eslint on devDependencies (locally).我在 devDependencies(本地)上安装了标准和 babel-eslint。
  • I run standard --parser babel-eslint我运行standard --parser babel-eslint
  • I get the standard use babel-eslint parser to recognize babel code style and not stating it as style error我得到标准使用 babel-eslint 解析器来识别 babel 代码样式,而不是将其声明为样式错误

What actually happened?究竟发生了什么?

  • I install both standard and babel-eslint on devDependencies (locally).我在 devDependencies(本地)上安装了标准和 babel-eslint。

  • I run standard --parser babel-eslint我运行标准 --parser babel-eslint

  • I get error: Cannot find module 'babel-eslint'我收到错误:找不到模块“babel-eslint”

I read from previous issues 85 1167 , it should be fixed when they are installed on the same level.我从以前的问题85 1167 中读到,当它们安装在同一级别时应该修复。 But it does not happen on mine.但它不会发生在我的身上。

I have tried to put config below on package.json:我试图将下面的配置放在 package.json 上:

"standard": {
    "parser": "babel-eslint"
  }

But it does not resolve the issue.但这并不能解决问题。

我通过这样做解决了这个问题:

npm install -g babel-eslint

已经在github问题https://github.com/standard/standard/issues/1257上解决了

尝试

$yarn add standard babel-eslint

嗨,这是一个老问题,但对于将来谁通过这里,这些答案对我不起作用,但这个答案对我有用:

npm install babel-eslint --save-dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM