node-dtrace-provider icon indicating copy to clipboard operation
node-dtrace-provider copied to clipboard

npm install fails - The build tools for v141 cannot be found

Open radcapitalist opened this issue 7 years ago • 3 comments

Hey,

I have a dependency on dtrace-provider (0.8.6) from bunyan. When I npm install, I get this failure:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [c:\blah\blah\blah\blah\blah\node_modules\dtrace-provider\build\DTraceProviderStub.vcxproj]

I installed 32-bit and 64-bit VC 2017 redist. It didn't help. I uninstalled that and installed VC 2015 redist (32-bit and 64-bit). it didn't help. How do I get this to install (and build) cleanly?

Thanks,

Eric

radcapitalist avatar Feb 27 '18 13:02 radcapitalist

@radcapitalist You'll want to make sure you have the node-gyp dependencies installed. I set them up locally by using chocolatey to install the python2 package, and installed the Visual C++ 2015 Build Tools. I then ran:

PS C:\Users\cody\Desktop\node-dtrace-provider> $env:Path += ";C:\Users\cody\Desktop\node-versions\node-v7.10.1-win-x64"
PS C:\Users\cody\Desktop\node-dtrace-provider> npm config set msvs_version 2015
PS C:\Users\cody\Desktop\node-dtrace-provider> npm install

> [email protected] install C:\Users\cody\Desktop\node-dtrace-provider
> node-gyp rebuild || node suppress-error.js


C:\Users\cody\Desktop\node-dtrace-provider>if not defined npm_config_node_gyp (node "C:\Users\cody\Desktop\node-versions
\node-v7.10.1-win-x64\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (n
ode "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.

Let me know if this doesn't work for you.

melloc avatar Feb 28 '18 23:02 melloc

Also: was the command exiting non-zero for you? Or just printing out an error message? In my local testing, %errorlevel% was zero when the dependencies weren't installed, since suppress-error.js takes care of handling the node-gyp failure.

melloc avatar Feb 28 '18 23:02 melloc

@melloc suppress-error.js doesn't seem to be suppressing node-gyp failures on Windows. 0.8.6 is in use by bunyan which is a dependency of ldapjs, and it spits out horrible error messages on an npm install when it finds python wasn't installed.

It's a harmless error but really confusing to customers who think they have an error:

λ npm i
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.

> [email protected] install C:\git\node-app\node_modules\dtrace-provider
> node-gyp rebuild || node suppress-error.js


C:\git\node-app\node_modules\dtrace-provider>if not defined npm_config_node_gyp (node "C:\Users\username\AppData\Roaming\nvm\v9.8.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\username\AppData\Roaming\nvm\v9.8.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\username\AppData\Roaming\nvm\v9.8.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\username\AppData\Roaming\nvm\v9.8.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Users\username\AppData\Roaming\nvm\v9.8.0\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:170:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\username\\AppData\\Roaming\\nvm\\v9.8.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\git\node-app\node_modules\dtrace-provider
gyp ERR! node -v v9.8.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

> [email protected] postinstall C:\git\node-app\node_modules\jsonpath
> node lib/aesprim.js > generated/aesprim-browser.js

etc...

alasdairhurst avatar Apr 18 '18 15:04 alasdairhurst