I'm trying to run a test script through package.json,
"test": "cross-env NODE_ENV=test nyc mocha --recursive --pilers js:babel-register --require babel-polyfill",
and on running I get the following error:
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'C:\Users\aw030085\Desktop\github\diabetesdashboard\node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
I have a coworker who can run it just fine, but he's not sure if he has anything extra installed. I'm not sure why it's throwing an error.
I have node 10.16.2 installed, using Windows 10.
I'm trying to run a test script through package.json,
"test": "cross-env NODE_ENV=test nyc mocha --recursive --pilers js:babel-register --require babel-polyfill",
and on running I get the following error:
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'C:\Users\aw030085\Desktop\github\diabetesdashboard\node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
I have a coworker who can run it just fine, but he's not sure if he has anything extra installed. I'm not sure why it's throwing an error.
I have node 10.16.2 installed, using Windows 10.
Share Improve this question edited Dec 19, 2019 at 17:13 user1779418 asked Dec 19, 2019 at 17:07 user1779418user1779418 4951 gold badge10 silver badges26 bronze badges 6-
Do you know if node has been added to
PATH
? - Assuming you're on Windows – SRR Commented Dec 19, 2019 at 17:08 - @S.Ramjit yes, it's on my system path as C:\Program Files\nodejs\node.exe – user1779418 Commented Dec 19, 2019 at 17:12
- Are you user aw030085? or this is just a route that makes sense on your coworker puter – Pablo Recalde Commented Dec 19, 2019 at 17:14
- @PabloRecalde yes, I am user aw030085 – user1779418 Commented Dec 19, 2019 at 17:14
- 2 you can always try deleting your node_modules and package-lock.json and then run npm install again. – Jake Commented Dec 19, 2019 at 17:19
2 Answers
Reset to default 7You can run this
npm uninstall nyc
npm i --save-dev nyc
A bit late to the party but if anyone has that problem, try lowering your node version. This is what worked for my teammate in one of our projects