Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

Hangs when installing VS2017 #135

Closed
jordanbtucker opened this issue Aug 13, 2018 · 4 comments
Closed

Hangs when installing VS2017 #135

jordanbtucker opened this issue Aug 13, 2018 · 4 comments

Comments

@jordanbtucker
Copy link

jordanbtucker commented Aug 13, 2018

C:\WINDOWS\system32>npm i -g --production --vs2017 install windows-build-tools

> windows-build-tools@3.1.0 postinstall C:\Users\Jordan\scoop\persist\nodejs-lts\bin\node_modules\windows-build-tools
> node ./dist/index.js

Downloading vs_BuildTools.exe
Downloading python-2.7.14.amd64.msi
[============================================>] 100.0% of 20.17 MB (8.07 MB/s)
Downloaded python-2.7.14.amd64.msi. Saved to C:\Users\Jordan\.windows-build-tools\python-2.7.14.amd64.msi.

Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

Status from the installers:
---------- Visual Studio Build Tools ----------
2018-08-12T23:30:25 : Verbose : [SetupUpdaterImpl]: Rpc connection was closed.
2018-08-12T23:30:25 : Verbose : [SetupUpdaterImpl]: Stream was closed

------------------- Python --------------------
Successfully installed Python 2.7

The only info that gets output is:

2018-08-12T23:30:25 : Verbose : [SetupUpdaterImpl]: Rpc connection was closed.
2018-08-12T23:30:25 : Verbose : [SetupUpdaterImpl]: Stream was closed

No Build Tools components get installed, and it just hangs forever.

@jordanbtucker
Copy link
Author

The RPC messages are red herrings. They're just left over messages from previous logs. If you delete the logs first, then it hangs with:

---------- Visual Studio Build Tools ----------
Still waiting for installer log file...

The actual failure is indicated in the dd_bootstrapper logs:

VisualStudio Bootstrapper:8/13/2018 2:37:30 AM: Starting vs setup process 'vs_installer.exe' with arguments '/finalizeInstall install --in "C:\ProgramData\Microsoft\VisualStudio\Packages\_bootstrapper\vs_setup_bootstrapper_201808130237109785.json" --norestart --quiet --add Microsoft.VisualStudio.Workload.VCTools --locale en-US --activityId "b3bbd12d-ae53-4412-b7f9-0a65e02a9ead"'.
VisualStudio Bootstrapper:8/13/2018 2:37:30 AM: Caught Exception: Type = ArgumentException, Message = Item has already been added. Key in dictionary: 'path'  Key being added: 'Path', StackTrace =    at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at System.Diagnostics.ProcessStartInfo.get_EnvironmentVariables()
   at Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.StartProcess(String exeDir, String exeName, String args)
VisualStudio Bootstrapper:8/13/2018 2:37:30 AM: Couldn't launch setup process. Error: Item has already been added. Key in dictionary: 'path'  Key being added: 'Path'
VisualStudio Bootstrapper:8/13/2018 2:37:30 AM: Caught Exception: Type = BootstrapperException, Message = Unable to launch the installer. Error: Item has already been added. Key in dictionary: 'path'  Key being added: 'Path', StackTrace =    at Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.StartProcess(String exeDir, String exeName, String args)
   at Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.ExecuteCore()
   at Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.<>c__DisplayClass20_0.<Execute>b__0(Object s)
InnerException:Type = ArgumentException, Message = Item has already been added. Key in dictionary: 'path'  Key being added: 'Path', StackTrace =    at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at System.Diagnostics.ProcessStartInfo.get_EnvironmentVariables()
   at Microsoft.VisualStudio.Setup.Bootstrapper.Bootstrapper.StartProcess(String exeDir, String exeName, String args)
VisualStudio Bootstrapper:8/13/2018 2:37:30 AM: Boostrapper failed. Exception: Unable to launch the installer. Error: Item has already been added. Key in dictionary: 'path'  Key being added: 'Path'

Apparently it doesn't like the fact that npm adds PATH and path aliases to the existing Path env var.

Patching launch.ts with:

delete process.env.PATH;
delete process.env.path;

right before it spawns powershell.exe seems to do the trick.

@jordanbtucker
Copy link
Author

The npm bug that's causing this issue.

https://npm.community/t/3-path-variables-are-assigned-to-child-process-launched-by-npm/1042

@jordanbtucker
Copy link
Author

A fix has been merged into npm-lifecycle, so it should be fixed in the next version of npm. Until then, it may be good to patch this for npm >=6.1.0 and <6.4.0.

@felixrieseberg
Copy link
Owner

@jordanbtucker Thank you so much for your excellent research! I've fixed this in 3859517.

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

No branches or pull requests

2 participants