create-react-app-typescript
create-react-app-typescript copied to clipboard
Error: Cannot find module '/home/user/test/node_modules/jest-cli'
Environment
-
npm ls react-scripts-ts
(if you haven’t ejected): └── (empty) -
node -v
: v8.4.0 -
npm -v
: 5.3.0 -
yarn --version
(if you use Yarn): 0.27.5 -
Operating system: Ubuntu 14.04
Steps to Reproduce
- create-react-app test --scripts-version=react-scripts-ts
- cd test && npm install
- npm run eject
- npm run test
> node scripts/test.js --env=jsdom
module.js:491
throw err;
^
Error: Cannot find module '/home/user/test/node_modules/jest-cli'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at getJest (/home/user/test/node_modules/jest/node_modules/jest-cli/build/cli/getJest.js:22:12)
at Object.run (/home/user/test/node_modules/jest/node_modules/jest-cli/build/cli/index.js:39:48)
at Object.<anonymous> (/home/user/test/scripts/test.js:27:6)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
Hmm, not sure why this happens. Is jest
listed in your package.json
?
I have the same error
Fyi I think it is this issue https://github.com/facebook/jest/issues/4419
Deleting my node_modules
and reinstalling them fixed it for me. I was playing around with yarn
and npm
together and I think some wires got crossed.
Confirmed, wiping node_modules
and yarn.lock
and doing yarn install
fixed mine.
It works again following that as yarn test
.
I have a feeling my reason was the same as ryanbrainard's. I also mixed a bit of npm and yarn along the way.
@ryanbrainard and @amackintosh Thanks for this. I also came across the same issue, I think the best way to stay away from this issue is to stick with one package manager.
rm -rf node_modules/ && yarn install
solved mine
Just ran into this too... blowing away node modules and running yarn install again fixed this. Not sure why this happened!
I had this issue today, and as @ryanbrainard mentioned, it was because I installed something with npm
and before I did with yarn
. So mixing both together caused this.
And yes, wiping out node_modules
fixed it.
Same here : fixed by removing node_modules
and reinstalling with yarn install
.
Thanks :)
I bumped into this even though I was just using npm, so it is probably not just about mixing package manages. But thanks guys for the fix it worked like magic!
Thanks @ryanbrainard
awesome this worked like a charm rm -rf node_modules/ && yarn install thanks @andela-ksolomon
Removing node_modules solved mine too! Very weird!