Javascript 找不到模块“;json模式;执行eslint时出错
我面临一个问题,我还没有在互联网上找到解决办法。我发现了一些类似的情况,但解决方案(主要是安装某些东西或清除缓存)在我的情况下不起作用 我已经为我的react项目安装了以下软件包(package.json):Javascript 找不到模块“;json模式;执行eslint时出错,javascript,ecmascript-6,eslint,eslintrc,Javascript,Ecmascript 6,Eslint,Eslintrc,我面临一个问题,我还没有在互联网上找到解决办法。我发现了一些类似的情况,但解决方案(主要是安装某些东西或清除缓存)在我的情况下不起作用 我已经为我的react项目安装了以下软件包(package.json): "devDependencies": { "@babel/core": "^7.9.6", "@babel/preset-env": "^7.9.6", "@babel/preset-react": "^7.9.4", "@n
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/preset-react": "^7.9.4",
"@ngtools/json-schema": "^1.1.0",
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.8",
"@types/react-router": "^5.1.7",
"@types/react-router-dom": "^5.1.5",
"@typescript-eslint/eslint-plugin": "^2.32.0",
"@typescript-eslint/parser": "^2.32.0",
"axios": "^0.19.2",
"babel-loader": "^8.1.0",
"bootstrap": "^4.4.1",
"cross-env": "^7.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.1",
"jquery": "^3.5.1",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.13",
"popper.js": "^1.12",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"resolve-url-loader": "^3.1.0",
"sass": "^1.26.5",
"sass-loader": "^8.0.0",
"source-map-loader": "^0.2.4",
"ts-loader": "^7.0.4",
"typescript": "^3.8.3"
},
"dependencies": {
"@emotion/core": "^10.0.28",
"@fortawesome/fontawesome-free": "^5.13.0",
"formik": "^2.1.4",
"moment": "^2.25.3",
"moment-timezone": "^0.5.28",
"react-currency-format": "^1.0.0",
"react-data-table-component": "^6.9.1",
"react-datepicker": "^2.15.0",
"react-flash-message": "^1.0.2",
"react-intl": "^4.5.3",
"react-loader-spinner": "^3.1.14",
"react-moment": "^0.9.7",
"react-pure-loaders": "^3.0.1",
"react-router-dom": "^5.2.0",
"redux-logger": "^3.0.6",
"styled-components": "^5.1.0",
"yup": "^0.28.5"
}
每次执行eslint检查文件时,都会出现以下错误:
Error: Failed to load parser '@typescript-eslint/parser' declared in '.eslintrc.js': Cannot find module 'json-schema'
我正在执行如下命令(在windows上):
node_modules.bin\eslint{my.tsx文件的路径}
这是我的.eslintrc.js
(默认生成的airbnb样式指南):
有人能为我找到解决办法吗?我已经尝试安装了几个
json模式
包,并且已经清除了cache/node\u modules文件夹。遗憾的是,到目前为止没有任何帮助。将.eslintrc.js
文件名重命名为。eslintrc
今天遇到了同样的问题。好像有更新。
在package.json中降级:
"@typescript-eslint/eslint-plugin": "^2.32.0",
"@typescript-eslint/parser": "^2.32.0",
至:
"@typescript-eslint/eslint-plugin": "2.25.0",
"@typescript-eslint/parser": "2.25.0",
目前已修复该问题。
希望这有帮助 你的解决方案并不能回答我的问题。8年后,这为我解决了问题。不得不从4.9.0或者别的什么降级@intelliJ这怎么还是个问题?
"@typescript-eslint/eslint-plugin": "2.25.0",
"@typescript-eslint/parser": "2.25.0",