未能满足安装Eslint和插件的对等关系

编辑2:现在它的工作。 必须删除所有本地eslint包。 一切都很好!

编辑:好的,安装特定的版本后,它抱怨(^ 1.16.0)它现在再次在命令行工作。 但是,那在Sublime内部确实无济于事。 有没有可能在这里错误的设置?

我之前有这个工作,但错误地再次安装相同的软件包后,它打破了。 最终我试图让ESLINT与Sublime一起工作。 我觉得崇高的一切都是正确的,因为我没有改变任何东西。 只是,Eslint不再工作了,'eslint app.jsx'等显示(见下文)。

我在eslint-plugin-import中得到了这个未满足的对等体依赖关系的错误。

aa:myResolutions Andreas$ sudo npm install -g eslint eslint-plugin-import Password: /usr/local/bin/eslint -> /usr/local/lib/node_modules/eslint/bin/eslint.js /usr/local/lib ├── eslint@3.7.1 └── eslint-plugin-import@2.0.0 aa:myResolutions Andreas$ sudo npm install -g eslint eslint-plugin-import eslint-config-airbnb eslint-plugin-react eslint-plugin-jsx-a11y /usr/local/bin/eslint -> /usr/local/lib/node_modules/eslint/bin/eslint.js /usr/local/lib ├── eslint@3.7.1 ├─┬ eslint-config-airbnb@12.0.0 │ └── UNMET PEER DEPENDENCY eslint-plugin-import@^1.16.0 ├── UNMET PEER DEPENDENCY eslint-plugin-import@2.0.0 ├── eslint-plugin-jsx-a11y@2.2.2 └── eslint-plugin-react@6.3.0 npm WARN eslint-config-airbnb@12.0.0 requires a peer of eslint-plugin- import@^1.16.0 but none was installed. npm WARN eslint-config-airbnb-base@8.0.0 requires a peer of eslint-plugin- import@^1.16.0 but none was installed. aa:myResolutions Andreas$ eslint App.jsx Oops! Something went wrong! :( ESLint couldn't find the plugin "eslint-plugin-import". This can happen for a couple different reasons: 1. If ESLint is installed globally, then make sure eslint-plugin-import is also installed globally. A globally-installed ESLint cannot find a locally- installed plugin. 2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following: npm i eslint-plugin-import@latest --save-dev 

我不明白。 我第一次安装它。 但是,它不再安装? 或者至less它不能被其他一些软件包find?

我已经在这一刻搔了一天了。 所有的插件都是全局安装的,所以不应该成为问题,而且在破解前也是这样。 而且我完全重新安装了node / npm,但似乎没有任何帮助。

任何人有任何想法如何解决这个问题?

注意airbnb包装https://www.npmjs.com/package/eslint-config-airbnb他们在安装之前陈述一些额外的信息。

首先删除所有已安装的软件包,它们应该是以下内容:

npm uninstall --save-dev eslint-plugin-react npm uninstall --save-dev eslint-plugin-jsx-a11y npm uninstall --save-dev eslint-plugin-import

在terminal运行:

export PKG=eslint-config-airbnb; npm info "$PKG" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG"

这将产生正确的依赖关系,例如:

npm install --save-dev eslint-config-airbnb eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.#

在这里检查这个答案:

 npm i -g eslint-config-airbnb-standard eslint -v