Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support npm_config_cache environment variable #1632

Open
xzyfer opened this issue Nov 3, 2016 · 9 comments
Open

Support npm_config_cache environment variable #1632

xzyfer opened this issue Nov 3, 2016 · 9 comments

Comments

@xzyfer
Copy link

xzyfer commented Nov 3, 2016

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

What is the expected behavior?

> node -p process.env.npm_config_cache

/Users/michael/.npm

Please mention your node.js, yarn and operating system version.

$ 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

@Daniel15
Copy link
Member

Daniel15 commented Nov 3, 2016

Is this documented anywhere in npm's documentation, or is it another undocumented npm environment thing like #1587?

@xzyfer
Copy link
Author

xzyfer commented Nov 3, 2016

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.

@xzyfer
Copy link
Author

xzyfer commented Nov 3, 2016

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_root environment variable.

@Daniel15
Copy link
Member

Daniel15 commented Nov 3, 2016

Thanks for the info! 😄

@johngeorgewright
Copy link

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

@rkrisztian
Copy link

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!

@EddyVinck
Copy link

I'm getting this issue as well

@jpbochi
Copy link

jpbochi commented Nov 8, 2019

3 full years, and no fix?
🕯 🕯 🕯
🍰

@jhchen6
Copy link

jhchen6 commented Jan 20, 2020

Getting the same issue. I was trying to use npm_config_* variables to pass command line arguments into the middle of a npm script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants