vue-cli3 新建的项目jest 运行报错

问题描述:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] unit: `jest --config test/unit/jest.conf.js --coverage`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] unit 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!     /Users/v_ligaoyan/.npm/_logs/2020-04-29T06_21_19_561Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `npm run unit`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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!     /Users/v_ligaoyan/.npm/_logs/2020-04-29T06_21_19_605Z-debug.log

这种问题感觉有点泛泛,网友们的方法:
1…/node_modules/jest/bin/jest.js --clearCach 或者 npm jest --clearCach
地址https://segmentfault.com/a/1190000019522911?utm_source=tag-newest
2.Clear down node_modules and remove package-lock.json. Re-run npm install.
Run npm cache verify and re-run npm install.
地址https://github.com/vuejs/vue-cli/issues/1879

我试了以上方法都不行,于是降低jest版本后解决:rm -rf node_modules 将json文件中的jest版本降低比如"^21.0.4”。然后重新安装再运行。

你可能感兴趣的:(vue)