我正在尝试使用react / jest进行测试。当我执行npm test / jest时,我收到以下错误:
> @ test /Users/suparnasoman/Downloads/create-react-app-master
> node packages/react-scripts/scripts/test.js --env=jsdom
module.js:471
throw err;
^
Error: Cannot find module 'jest'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/suparnasoman/Downloads/create-react-app-master/packages/react-scripts/scripts/test.js:26:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Test failed. See above for more details.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
答案 0 :(得分:1)
node_modules/bin/jest
答案 1 :(得分:0)
似乎缺少了jest模块,你是否按照Chase提到的那样尝试了npm --save install jest
或npm install
?