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

Single-proc build breaks with npm_config_cache already defined #5985

Closed
asklar opened this issue Sep 13, 2020 · 0 comments · Fixed by #5986
Closed

Single-proc build breaks with npm_config_cache already defined #5985

asklar opened this issue Sep 13, 2020 · 0 comments · Fixed by #5986

Comments

@asklar
Copy link
Member

asklar commented Sep 13, 2020

yarn sets up some environment variables (like npm_config_cache) and calls execSync. This calls the Win32 API CreateProcess and passes an environment block which is a merge of the existing environment block (i.e. from the calling process) with some additional stuff that includes npm_config_cache among others.

Environment variables in Windows are case-insensitive, but CreateProcess does not sanitize the environment block. This is a problem because if the calling process had set up NPM_CONFIG_CACHE (all caps), then yarn will just set the lowercase variant of the variable, and node will call CreateProcess which will contain the variable twice.
This breaks some tools that create dictionaries out of the environment block because they expect to run into each variable exactly once (regardless of casing).

run-windows is invoked via yarn, and it calls msbuild which crashes when trying to set up options for the compiler when it finds this option twice. We run into this when building in our CI in Azure DevOps pipeline, which sets up NPM_CONFIG_CACHE in the environment.

Related:

actions/runner-images#1566
dotnet/msbuild#5726
nodejs/node#35129
dotnet/runtime#42029
https://developercommunity.visualstudio.com/content/problem/1179475/multitooltask-should-sanitize-environment-variable.html
yarnpkg/yarn#8334

@asklar asklar transferred this issue from microsoft/react-native-windows-samples Sep 13, 2020
@ghost ghost added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label Sep 13, 2020
@chrisglein chrisglein added this to the 0.64 milestone Sep 14, 2020
@chrisglein chrisglein added Area: Build Infrastructure bug and removed Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) labels Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants