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”。然後重新安裝再運行。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章