【问题标题】:eslint won't update past v4.5.0, "Error: Cannot find module 'eslint-config-google'"eslint 不会更新超过 v4.5.0,“错误:找不到模块 'eslint-config-google'”
【发布时间】:2018-12-18 02:43:44
【问题描述】:

我有一个旧版本的eslint

eslint -v
v4.5.0

更新eslint我跑了:

npm install -g eslint

回复说eslint@5.9.0已经安装成功。按照我项目根目录中documentation 中的说明,我运行了

eslint --init

我选择了 Google 风格指南。安装说

The style guide "google" requires eslint@>=5.4.0. You are currently using eslint@4.5.0.
  Do you want to upgrade? (Y/n) 

这看起来很奇怪,因为我刚刚安装了 5.9.0,但我说是的。回复说安装成功:

Successfully created .eslintrc.json file in /Users/TDK/LanguageTwo
ESLint was installed locally. We recommend using this local copy instead of your globally-installed copy.

然后我跑了

eslint -v
v4.5.0

我检查了echo $PATH 并没有看到类似eslintvm 锁定旧版本。

我尝试 lint 文件并收到以下错误消息:

Error: Cannot find module 'eslint-config-google'

eslint v5.9.0 现在本地安装在我的项目根目录中,我可以在节点模块中看到eslint-config-google。 eslint 5.9.0 全局安装。我的猜测是“丢失”eslint-config-google 是因为我的计算机仍在运行 eslint v4.5.0。我重新启动了我的电脑。是什么让 eslint 保持在 v4.5.0?

【问题讨论】:

  • 今天早上我运行了 eslint -v,它说 v5.9.0,显然需要多次重启计算机。我仍然收到错误消息“错误:找不到模块 'eslint-config-google'”。

标签: eslint


【解决方案1】:

我使用了 find 。 -name 'eslint' 从每个目录中删除每个 eslint 副本。 npm uninstall -g eslint 没有删除每个模块。然后我重新安装了 eslint 并运行了eslint init。现在它是 v5.9.0。还是有错误

Error: Cannot find module 'eslint-config-google'

我不知道是什么导致了这个问题。

【讨论】:

    猜你喜欢
    • 2018-11-19
    • 2017-01-04
    • 2020-02-28
    • 2017-10-04
    • 2018-05-26
    • 2017-12-01
    • 2021-12-13
    • 1970-01-01
    • 2022-01-20
    相关资源
    最近更新 更多