Cannot find module 'request'
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What is the current behavior?
When I run Jest, it fails immediately with Cannot find module 'request'
, but I don’t require request
myself, it’s part of the Jest dependency tree.
λ npm test -- --no-cache
> nima-bot@0.0.1 test C:\Users\E\Documents\GitHub\nima
> jest "--no-cache"
FAIL src\__tests__\modules\calc.js
● Test suite failed to run
Cannot find module 'request'
at node_modules/request-promise-native/lib/rp.js:8:12
at module.exports (node_modules/stealthy-require/lib/index.js:62:23)
at Object.<anonymous> (node_modules/request-promise-native/lib/rp.js:7:15)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.238s
Ran all test suites.
npm ERR! Test failed. See above for more details.
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install
and yarn test
.
I’ve pushed a branch named wtf-jest
to a branch that you can test it out on: https://github.com/denizdogan/nima/tree/wtf-jest
git clone -b wtf-jest https://github.com/denizdogan/nima
cd nima
yarn i
yarn test
What is the expected behavior?
I expect Jest to run my test suites.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
NPM 5.6.0 Node.js 9.4.0 Jest 22.1.4 Windows 10 (64-bit)
Issue Analytics
- State:
- Created 6 years ago
- Comments:9
Top GitHub Comments
Something is up with your installed tree, doing
npm dedupe && npm prune && npm install
makes the test green.Also, you should install the babel core bridge if you’re using babel 7 (see https://facebook.github.io/jest/docs/en/getting-started.html#additional-configuration)
I had the same problem.
npm list request
saidUNMET PEER DEPENDENCY request@2.88.2
. Callingnpm i -D jest
fixed the issue