Do you want to request a feature or report a bug?
bug
What is the current behavior?
yarn run v0.16.1
$ node -p process.env.npm_config_cache
undefined
✨ Done in 0.28s.
If the current behavior is a bug, please provide the steps to reproduce.
Print process.env.npm_config_cache in an npm script
"scripts": {
"foo": "node -p process.env.npm_config_cache"
}
yarn run foo
md5-5c852f945cee9f74fd95aaf23d26c0e1
> node -p process.env.npm_config_cache
/Users/michael/.npm
md5-aea117191b84349c110c6270d925190b
$ node -p process.versions
{ http_parser: '2.7.0',
node: '6.5.0',
v8: '5.1.281.81',
uv: '1.9.1',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '57.1',
modules: '48',
openssl: '1.0.2h' }
$ node -v
v6.5.0
$ npm -v
3.10.3
$ yarn --version
0.16.1
OS X El Capitan
Is this documented anywhere in npm's documentation, or is it another undocumented npm environment thing like #1587?
npm makes all config available in the script environment with a npm_config_ prefix. As such all the documented config settings are expected to be available.
This behaviour is documented under npm scripts.
Configuration parameters are put in the environment with the
npm_config_prefix. For instance, you can view the effective root config by checking the npm_config_rootenvironment variable.
Thanks for the info! 😄
Something also to note; Any config variable set as [package_name]:foo, or variables listed under the package.config object will be added as "per-package" environment variables. E.g: process.env.npm_package_config_foo.
https://docs.npmjs.com/misc/config#per-package-config-settings
We can't switch to yarn without this, and none of the npm_config_* vars that we depend on works. So please, implement this feature!
I'm getting this issue as well
3 full years, and no fix?
🕯 🕯 🕯
🍰
Getting the same issue. I was trying to use npm_config_* variables to pass command line arguments into the middle of a npm script.
Most helpful comment
We can't switch to yarn without this, and none of the
npm_config_*vars that we depend on works. So please, implement this feature!