toddbluhm / env-cmd

Setting environment variables from a file
https://www.npmjs.com/package/env-cmd
MIT License
1.73k stars 65 forks source link

fails to run 'nyc mocha' #360

Closed vit100 closed 1 year ago

vit100 commented 1 year ago

env-cmd fails to run the command script with nyc@11.9.

npm script:

{
  "scripts:{
    "test": "env-cmd nyc mocha"
  }
}

Error: internal/modules/cjs/loader.js:638 throw err; ^

Error: Cannot find module 'C:\Dev\myApp\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:623:3)

But if the test script run without nyc, like env-cmd mocha - all is good.

Option use-shell doesn't help either.

Solution - Update nyc to the latest - and it is working again. Not sure if it is nyc issue or env-cmd