我使用create-react-app创建我的应用程序,然后使用NPM安装了一些我想使用的软件包。当我使用npm start run时,一切运行正常,并且没有任何错误。但是,当我尝试使用npm run build时,出现以下错误:
Creating an optimized production build...
Failed to compile.
Cannot read property 'length' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! runner@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the runner@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! C:\Users\Me\AppData\Roaming\npm-cache\_logs\2019-04-29T21_10_16_413Z-debug.log
当我查看日志时,找不到任何指向故障排除的信息。我检查了代码,在任何地方都不使用任何长度变量。我假设故障在其他地方,但是我什至不知道从哪里开始寻找。这很奇怪,因为当我使用npm run start时它可以工作。
这是我的package.json:
{
"name": "runner",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.8.2",
"react-dom": "^16.8.2",
"react-scripts": "2.1.5",
"react-bootstrap": "1.0.0-beta.8",
"react-timeseries-charts": "0.15.5",
"pondjs": "0.8.10",
"bootstrap": "4.3.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}