gpt4 book ai didi

sublimetext - SublimeLinter ESLint找不到插件

转载 作者:行者123 更新时间:2023-12-03 13:35:07 27 4
gpt4 key购买 nike

在Sublime Text Editor 3.x中编辑javascript文件时,出现错误:

Oops! Something went wrong! :(

ESLint: 6.0.1.

ESLint couldn't find the plugin "eslint-plugin-chai-expect".

(The package "eslint-plugin-chai-expect" was not found when loaded as a Node module from the directory "C:\workspace\flltools".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-chai-expect@latest --save-dev

The plugin "eslint-plugin-chai-expect" was referenced from the config file in "modules\scoring\.eslintrc.yml".

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

我尝试了多种在网上找到的解决方案,包括删除全局ESLint/将所有与ESLint相关的软件包都移到全局,以及更改 SublimeLinter.settings文件。该问题仅在通过Sublime运行 Lint 时出现。当我运行 eslint命令时,它可以完美运行。

如果有人知道为什么会发生这种情况,请帮助我!

谢谢

最佳答案

据我所知,这确实是迁移到ESLint v6的问题。但这不是全局安装问题。

现在的问题是,ESLint在运行eslint命令的工作目录中查找。如您在your comment中所说:

It seems to be looking in a parent folder (as you can see in the error it's looking in c:/workspace/flltools, whereas my project is in c:/workspace/flltools/modules/scoring



因此,您的编辑器在父目录中而不是 package.json文件所在的目录中运行eslint。我猜您的编辑器的项目根目录比package.json文件所在的目录高一级。

看起来确实已经通过github问题#1626在SublimeLinter插件中对其进行了修补: Wrong working directory on nested local eslint installs (breaks eslint@6)

请注意,VSCode和Vim都存在类似的问题,因此这不是Sublime Text的问题,而是ESLint的问题。

在ESLint v6迁移文档中,它有一个关于 "Plugins and shareable configs are no longer affected by ESLint’s location"的部分。它表明:

If you use a config file located outside of a local project (with the --config flag), consider installing the plugins as dependencies of that config file, and setting the --resolve-plugins-relative-to flag to the location of the config file.



--resolve-plugins-relative-to将解决此问题,因为您可以指定 package.json所在的路径。

关于sublimetext - SublimeLinter ESLint找不到插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56879118/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com