1.执行npm run test出现 code ELIFECYCLE errno 1 错误
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jesttest@1.0.0 test: `jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jesttest@1.0.0 test 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\Liu123\AppData\Roaming\npm-cache\_logs\2022-06-17T05_42_35_860Z-debug.log
我在csdn上查找原因,有人说是modules有缺失或者改动或者过大,试过删除项目中的node_modules和package-lock.json再重新npm install等发现还是不可以
后面在外网看到这个可以不叫错误,只是Jest 以代码 1 退出,因为测试失败。
为了防止这种情况,可以使用–silentor-s标志来避免 npm 错误消息。
npm -s run test
执行这个命令后会提示我测试代码有一个地方名称出错了,然后我进行了修改,就可以正常测试了
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 0.38 s
Ran all test suites.
2.执行 npm start 出现 code ELIFECYCLE errno 1 错误
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aip-web-template@0.1.0 start: `node --max_old_space_size=8128 --trace-deprecation scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aip-web-template@0.1.0 start 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\Liu123\AppData\Roaming\npm-cache\_logs\2022-06-21T01_16_02_374Z-debug.log