简体   繁体   English

Mac WebStorm错误:无法找到模块'eslint-config-airbnb'

[英]Mac WebStorm Error: Cannot find module 'eslint-config-airbnb'

I'm on a ReactNative project and prefer to use airbnb. 我正在使用ReactNative项目并且更喜欢使用airbnb。 I have npm install airbnb global: 我有npm安装airbnb global:

  1. npm install -g airbnb (and also dependencies) npm install -g airbnb (以及依赖项)
  2. Made .eslintrc file with config "extends": eslint-config-airbnb 使用配置“extends”制作.eslintrc文件: eslint-config-airbnb
  3. WebStorm enabled ESLint and use above .eslintrc WebStorm启用了ESLint并使用上面的.eslintrc

Got error below: 得到以下错误:

Error: Cannot find module 'eslint-config-airbnb' 错误:找不到模块'eslint-config-airbnb'

Other info: 其他信息:

  • MacOS 苹果系统
  • WebStorm 2017.1.2 WebStorm 2017.1.2

Plugin and eslint needs to be installed at the same location ie if eslint s global then plugin need to be global and if its local then both need to be local. 插件和eslint需要安装在同一个位置,即如果eslint是全局的,则插件需要是全局的,如果是本地的则需要是本地的。

With that Webstorm uses local version of eslint and not global (thats how at least work on windows). 有了这个Webstorm使用本地版本的eslint而不是全局(这至少是如何在Windows上工作)。 So make sure you install eslint and plugin locally using npm install . 因此,请确保使用npm install在本地安装eslint和插件。

I hope this helps. 我希望这有帮助。

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

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