5

I'm trying to run a test script through package.json,

"test": "cross-env NODE_ENV=test nyc mocha --recursive --compilers 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.

6
  • Do you know if node has been added to PATH? - Assuming you're on Windows Commented Dec 19, 2019 at 17:08
  • @S.Ramjit yes, it's on my system path as C:\Program Files\nodejs\node.exe Commented Dec 19, 2019 at 17:12
  • Are you user aw030085? or this is just a route that makes sense on your coworker computer Commented Dec 19, 2019 at 17:14
  • @PabloRecalde yes, I am user aw030085 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. Commented Dec 19, 2019 at 17:19

2 Answers 2

7

You can run this

npm uninstall nyc
npm i --save-dev nyc
Sign up to request clarification or add additional context in comments.

1 Comment

I had the exact same problem and the given solution worked
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.