npm - 无法加载在“.eslintrc.json”中声明的插件“react”:找不到模块“eslint-plugin-react”
问题描述
在本地运行时,它似乎工作正常,但在管道上运行时崩溃
编辑:删除 npx 后,它会产生不同的错误:
我已遵循安装插件的建议:
npm install eslint-plugin-react@latest --save-dev
但渗出重演。
这是我收回的 bitbucket-pipelines.yml 配置:
- step:
name: CI
caches:
- node
script:
- npm install
- npm run lint
- npm run test
等同于 package.json
"lint": "eslint --ext .js,.ts,.tsx src --ignore-pattern node_modules/",
"test": "jest --verbose --colors --coverage",
这是我的 eslint 配置文件:
{
"env": {
"browser": true,
"es6": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"airbnb"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".tsx"],
"paths": ["src"]
}
}
},
"rules": {
...
}
}
}
解决方案
Visual Studio Code 的更新为我解决了这个问题。
我在不知不觉中使用了 2 岁的版本。
推荐阅读
- java - 创建对象将最后创建的对象的值分配给java中Arraylist中的每个其他对象
- rust - 使用 std::iter::Iterator::reduce 进行求和的正确语法是什么?
- c# - 当用户输入与字符串匹配的关键字时,将执行 Else 语句
- python - python中的Psychopy:按下键时有两个答案,释放键时有第二个答案
- ios - 使用 textField 以编程方式加载键盘并使用 swift 发送按钮
- php - 如何记录通过php销毁会话的时间
- d3.js - ObservableHQ 中的 FileAttachment - 如果在 2 个单元格或 1 个单元格内,则行为不同:TypeError:reading.map 不是函数
- r - 使用R的宽格式数据帧到长格式数据帧
- php - 错误 [RuntimeException] 无法扫描“数据库/种子”中的类
- android - UE4 断言在 opengles.h 中失败,但我知道 ue4 可以在我的设备上运行。如何解决?