【发布时间】:2022-01-30 16:02:28
【问题描述】:
我使用 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。
【问题讨论】:
标签: docker jestjs create-react-app