DEV Community

Discussion on: Environment variables in Node.js. The Right way!

Collapse
 
chrissyast profile image
chrissyast

My script is currently

"serve": "vue-cli-service serve"

I tried adding "node -r dotenv/config vue-cli-service serve"

I ran that but then it failed to compile

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

Error: Cannot find module './front/vue-cli-service'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! front@0.1.0 serve: `node -r dotenv/config vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the front@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.