Receiving this warning on running a node.js app despite all testing suggesting everything fine.
I've included the below code in my app to fault find:
console.log('NODE_ENV: ' + config.util.getEnv('NODE_ENV'));
console.log('NODE_CONFIG_DIR: ' + config.util.getEnv('NODE_CONFIG_DIR'));
And the output in terminal is:
NODE_ENV: test
NODE_CONFIG_DIR: C:\Users\[username]\OneDrive - [Company Name]\Documents\projects\[project name]\server\config
Terminal Output
Inside that folder (verified by copying and pasting the URI into explorer) are two files:
default.json
test.json
Config folder contents
That seems to be correct to me, I've checked the guidance and can't see anything out, checked google hits and the answers don't appear to relate. Any help would be greatly appreciated.
Though the mentioned package in the accepted answer resolves the issue, it is good not to get more dependencies in your project's package.json
when the same can be sorted with a simple tweak as below: -
In your package.json
file by omitting the space before &&
. This will detect the environment(s) correctly without extra space after the name.