npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Missing environment variables when `npm start` ?

For a simple test.js file:


When I run it with node test.js I get different results vs when I run npm start, where the start command is defined in package.json as:

"start": "node test.js",

When running with npm start I get:

{ npm_package_dependencies_parse_link_header: '^1.0.1',
  npm_config_cache_lock_stale: '60000',
  npm_package_dependencies_bluebird: '^3.0.0',
  npm_package_dependencies_cesium: '^1.35.1',
  npm_config_legacy_bundling: '',
  npm_config_sign_git_tag: '',
  npm_config_user_agent: 'npm/3.10.10 node/v6.15.1 linux x64',
  npm_config_always_auth: '',
  NODE_VERSION: '6.15.1',

And directly with node test.js:

{ YARN_VERSION: '1.12.3',
  HOSTNAME: 'xxxxxxxxxxxxx',
  'repositories__AnalyticalGraphicsInc/cesium__gitHubToken': 'xxxxxxxxxxxxxxxxxxxxxxxx',

I’m assuming the extra environment variables there are intentional, perhaps npm setting up its environment. The issue is that my actual config variables are missing. The variable repositories__AnalyticalGraphicsInc/cesium__gitHubToken is nowhere to be found. Is npm filtering these from the list? Is this a recent change?

I was able to get the missing variables by adding --script-shell=/bin/bash where it was defaulting to /bin/sh. Hope that helps anyone who runs into this.