eslint-config-react-app/jest': 无法读取未定义的 属性 'meta'
eslint-config-react-app/jest': Cannot read property 'meta' of undefined
我用 create-react-app 创建了一个项目。当我 运行 docker build frontend -t my-frontend .
:
时出现此错误
> frontend@0.1.0 build /app
> react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to load plugin 'jest' declared in 'package.json » eslint-config-react-app/jest': Cannot read property 'meta' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-01-27T11_11_23_140Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
我该如何解决?我试过 npm install
,npm install .
,npm audit fix
.
这是我的笑话 package.json
:
{
...
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
...,
"web-vitals": "^1.0.1"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
...
}
这是我的笑话 package.lock.json
:
"eslint-plugin-jest": {
"version": "24.1.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.3.tgz",
"integrity": "...",
"requires": {
"@typescript-eslint/experimental-utils": "^4.0.1"
}
},
我还看到 eslint-plugin-jest gives "ESLint stack trace: TypeError: Cannot read property 'meta' of undefined" 说:“这是 22.6 到 22.6.2 中的一个临时问题”,但我的版本是 24.1.3。
已由 npm audit fix --force
修复,但在 运行 之前,请确保它不会损坏您的项目。
npm audit fix only modifies the dependencies that shouldn't cause problems based on SEMVER rules. The --force is a dangerious option because it upgrades the dependencies regardless of any rules. This can cause a dependency to go from version 1.2. 0 to version 2.3.
What did a npm audit fix --force change and how do you fix it?
我用 create-react-app 创建了一个项目。当我 运行 docker build frontend -t my-frontend .
:
> frontend@0.1.0 build /app
> react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to load plugin 'jest' declared in 'package.json » eslint-config-react-app/jest': Cannot read property 'meta' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-01-27T11_11_23_140Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
我该如何解决?我试过 npm install
,npm install .
,npm audit fix
.
这是我的笑话 package.json
:
{
...
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
...,
"web-vitals": "^1.0.1"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
...
}
这是我的笑话 package.lock.json
:
"eslint-plugin-jest": {
"version": "24.1.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.3.tgz",
"integrity": "...",
"requires": {
"@typescript-eslint/experimental-utils": "^4.0.1"
}
},
我还看到 eslint-plugin-jest gives "ESLint stack trace: TypeError: Cannot read property 'meta' of undefined" 说:“这是 22.6 到 22.6.2 中的一个临时问题”,但我的版本是 24.1.3。
已由 npm audit fix --force
修复,但在 运行 之前,请确保它不会损坏您的项目。
npm audit fix only modifies the dependencies that shouldn't cause problems based on SEMVER rules. The --force is a dangerious option because it upgrades the dependencies regardless of any rules. This can cause a dependency to go from version 1.2. 0 to version 2.3.
What did a npm audit fix --force change and how do you fix it?