MSBUILD : Configuration error MSB4148 "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" has zero length

Issue

I’m trying yo install electron-chromedrive by using yarn, so by doing this command:

yarn add --dev electron-chromedriver --network-timeout 100000

But it gives the following error:

MSBUILD : Configuration error MSB4148 "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" has zero length

Precisely:

gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\vipul\AppData\Roaming\nvm\v16.14.2\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:526:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Windows_NT 10.0.19043
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\vipul\software\desktop\webapp\src
gyp ERR! node -v v16.14.2
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
error Command failed with exit code 1.

How can I solve it?

Solution

I’ve solved the issue by removing the MSBUILD keys in regedit

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\4.0]

And after that I’ve reinstalled Visual Studio again.

Answered By – Vipul Learning

Answer Checked By – Robin (AngularFixing Admin)

Leave a Reply

Your email address will not be published.