chrisa / node-dtrace-provider

Native DTrace probes for node.js apps
Other
319 stars 70 forks source link

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

Open radcapitalist opened 6 years ago

radcapitalist commented 6 years ago

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

melloc commented 6 years ago

@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

> dtrace-provider@0.8.6 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 commented 6 years ago

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.

alasdairhurst commented 6 years ago

@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 nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN deprecated nomnom@1.5.2: Package no longer supported. Contact support@npmjs.com for more info.

> dtrace-provider@0.8.6 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

> jsonpath@1.0.0 postinstall C:\git\node-app\node_modules\jsonpath
> node lib/aesprim.js > generated/aesprim-browser.js

etc...