Description
Summary
When settings are defined in .npmrc
, commands such as npm run
, pnpm run
, and yarn run
map these settings to subprocess environment variables so that they can be easily accessed by the invoked script. rushx
is missing this feature.
Repro steps
@Tanimodori provided a very helpful repro here, which defines a variable in <project folder>/.npmrc
as well as common/config/rush/.npmrc
:
https://github.com/Tanimodori/rushx-npmrc-issue
In this repro, rushx
doesn't declare any environment variables.
Here's a comparison of outputs from other tools:
npm run test:
NPM_CLI_JS=C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
npm_command=run-script
npm_config_cache=C:\Users\Owner\AppData\Local\npm-cache
npm_config_globalconfig=C:\Program Files\nodejs\etc\npmrc
npm_config_global_prefix=C:\Program Files\nodejs
npm_config_init_module=C:\Users\Owner\.npm-init.js
npm_config_local_npmrc_var=local_npmrc_var
npm_config_local_prefix=C:\GitR\rushx-npmrc-issue\packages\example-package
npm_config_metrics_registry=https://registry.npmjs.org/
npm_config_node_gyp=C:\Users\Owner\AppData\Roaming\nvm\v16.17.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js
npm_config_noproxy=
npm_config_prefix=C:\Program Files\nodejs
npm_config_userconfig=C:\Users\Owner\.npmrc
npm_config_user_agent=npm/8.15.0 node/v16.17.0 win32 x64 workspaces/false
npm_execpath=C:\Users\Owner\AppData\Roaming\nvm\v16.17.0\node_modules\npm\bin\npm-cli.js
npm_lifecycle_event=test
npm_lifecycle_script=node index.js
npm_node_execpath=C:\Program Files\nodejs\node.exe
npm_package_json=C:\GitR\rushx-npmrc-issue\packages\example-package\package.json
npm_package_name=example-package
npm_package_version=0.0.1
NPM_PREFIX_NPM_CLI_JS=C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
pnpm run test:
npm_command=run-script
npm_config_LOCAL_NPMRC_VAR=local_npmrc_var
npm_config_node_gyp=C:\Users\Owner\AppData\Roaming\nvm\v16.17.0\node_modules\pnpm\dist\node_modules\node-gyp\bin\node-gyp.js
npm_config_registry=https://registry.npmjs.org/
npm_config_user_agent=pnpm/8.5.1 npm/? node/v16.17.0 win32 x64
npm_execpath=C:\Users\Owner\AppData\Roaming\nvm\v16.17.0\node_modules\pnpm\bin\pnpm.cjs
npm_lifecycle_event=test
npm_lifecycle_script=node index.js
npm_node_execpath=C:\Program Files\nodejs\node.exe
npm_package_author=
npm_package_description=
npm_package_license=ISC
npm_package_main=index.js
npm_package_name=example-package
npm_package_scripts_test=node index.js
npm_package_version=0.0.1
yarn run test:
npm_config_argv={"remain":[],"cooked":["run","test"],"original":["run","test"]}
npm_config_bin_links=true
npm_config_ignore_optional=
npm_config_ignore_scripts=
npm_config_init_license=MIT
npm_config_init_version=1.0.0
npm_config_LOCAL_NPMRC_VAR=local_npmrc_var
npm_config_registry=https://registry.yarnpkg.com
npm_config_save_prefix=^
npm_config_strict_ssl=true
npm_config_user_agent=yarn/1.22.19 npm/? node/v16.17.0 win32 x64
npm_config_version_commit_hooks=true
npm_config_version_git_message=v%s
npm_config_version_git_sign=
npm_config_version_git_tag=true
npm_config_version_tag_prefix=v
npm_execpath=C:\Users\Owner\AppData\Roaming\nvm\v16.17.0\node_modules\yarn\bin\yarn.js
npm_lifecycle_event=test
npm_lifecycle_script=node index.js
npm_node_execpath=C:\Program Files\nodejs\node.exe
npm_package_description=
npm_package_license=ISC
npm_package_main=index.js
npm_package_name=example-package
npm_package_scripts_test=node index.js
npm_package_version=0.0.1
Details
There are some differences in the outputs, but they all successfully define npm_config_LOCAL_NPMRC_VAR
. The GLOBAL_NPMRC_VAR
is only expected from rushx
, since it is aware of common/config/rush/.npmrc
.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question | Answer |
---|---|
@microsoft/rush globally installed version? |
5.90.0 |
rushVersion from rush.json? |
5.90.0 |
useWorkspaces from rush.json? |
true |
Operating system? | Windows |
Would you consider contributing a PR? | Yes |
Node.js version (node -v )? |
16.17.0 |
Metadata
Metadata
Assignees
Labels
Type
Projects
Status