[英]eslint "Cannot find module 'eslint/lib/util/source-code'" error
I am trying to run eslint using yarn lint
.我正在尝试使用
yarn lint
运行 eslint 。 When I run it, it fails with the following output:当我运行它时,它失败并显示以下输出:
shane@shanePC$ yarn lint yarn run v1.22.17 $ eslint --ext .js --ext .jsx . Oops! Something went wrong! :( ESLint: 7.32.0 Error: Failed to load plugin 'import' declared in '.eslintrc.json » @deep-security/eslint-config » eslint-config-standard': Cannot find module 'eslint/lib/util/source-code' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (/home/shane/src/c1ws-tdax-ui/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) at Object. (/home/shane/src/c1ws-tdax-ui/node_modules/eslint-plugin-import/lib/ExportMap.js:20:19) at Module._compile (/home/shane/src/c1ws-tdax-ui/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I assume the problem is with my package.json
, so here it is (proprietary information has been redacted):我认为问题出在我的
package.json
,所以在这里(专有信息已被编辑):
{
"name": "<redacted>",
"version": "1.0.0",
"private": true,
"main": "index.js",
"repository": "<redacted>",
"license": "SEE LICENSE IN LICENSE",
"publishConfig": {
"registry": "<redacted>"
},
"devDependencies": {
"<redacted>": "<redacted>",
"react-scripts": "^4.0.3"
},
"dependencies": {
"<redacted>": "<redacted>",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-intl": "^5.21.0",
"react-redux": "^7.2.6"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom --watchAll=false",
"eject": "react-scripts eject",
"lint": "eslint --ext .js --ext .jsx ."
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
In case it is relevant, here is my .eslintrc.json
as well:如果相关,这里也是我的
.eslintrc.json
:
{
"extends": [
"<redacted>",
"<redacted>"
],
"env": {
"jest": true
},
"rules": {
"import/no-named-default": "off"
},
"parser": "babel-eslint"
}
I am running node 10.19.0 and yarn 1.22.17.我正在运行节点 10.19.0 和纱线 1.22.17。 My OS is Linux Ubuntu 20.04.
我的操作系统是 Linux Ubuntu 20.04。
How can I fix my setup so that yarn lint
will successfully run eslint on my project?如何修复我的设置,以便
yarn lint
能够在我的项目上成功运行 eslint?
in your package.json, try:在你的 package.json 中,尝试:
"lint": "eslint --ext .js,.jsx ." "lint": "eslint --ext .js,.jsx ."
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.