testcafe Command failed: "npm

311 views Asked by At

I installed testcafe globally and it was working with no issues, then I decided to install testcafe locally upon which it said it couldn't find npm in the node modules folder of my project. Then I installed npm locally and it started working again. After a while a decided to delete the local one and use the global but now that's broken and it keeps looking for the one in my local projects folder?!?! So if I then install npm in my local project again I get the following error:

Error: Command failed: "npm

    at ChildProcess.exithandler (child_process.js:295:12)
    at ChildProcess.emit (events.js:210:5)
    at ChildProcess.EventEmitter.emit (domain.js:476:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

Error when npm isn't installed in my local project:

ERROR Tested app failed with an error:

Error: Command failed: "npm
internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module 'C:\Users\User\app\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
0

There are 0 answers