node-gyp: msbuild error MSB4025
I’m using Windows 10
, node 7.7.2
, npm 4.1.2
I get this error when running node-gyp rebuild
for after installing the binding module leveldown
(My objective is to rebuild it for electron). The specific error is…
MSBUILD : error MSB4025: The project file could not be loaded. Root element is missing.
I searched for this error but it seemed to be specific to visual studio projects and xml files. I don’t have a lot of context since I’m not usually a windows user. Somewhere I found that you can specific --msvs_version=2013
, that did not work. But I tried with 2017
(because that’s the latest download) and I got the following error.
Traceback (most recent call last):
File "C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
return gyp_main(args)
File "C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 514, in gyp_main
options.duplicate_basename_check)
File "C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 98, in Load
generator.CalculateVariables(default_variables, params)
File "C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1900, in CalculateVariables
generator_flags.get('msvs_version', 'auto'))
File "C:\Users\Gebruiker\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion
versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2017'
If anyone has any idas I would be very grateful! -S
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 14
- Comments: 65 (26 by maintainers)
Commits related to this issue
- Add support to build node.js with chakracore. Microsoft's chakracore engine is dependent on Windows SDK, and build tools should know the version installed on user machine. This change adds those depe... — committed to nodejs/node-gyp by kunalspathak 8 years ago
- Update Find-VS2017.cs This makes the parsing more robust and fixes the additional issue related to #1144 — committed to Loghorn/node-gyp by Loghorn 6 years ago
- win: improve parsing of SDK version This makes the parsing more robust and fixes the additional issue related to USB Device Connectivity component. Fixes: https://github.com/nodejs/node-gyp/issues/1... — committed to Loghorn/node-gyp by Loghorn 6 years ago
3.6.0 supports VS2017 You can install
Build Tools for Visual Studio 2017
, make sure to selectC++ tools
,Windows 10 SDK
andMSBuild
and your set.This bug can be closed /cc @rvagg
Edit
for
node-gyp@3.6.0
do not install any of the special SDKs (red) only any of the greens P.S. you only need one, and best tested is 10393I solved this error by running
npm install --global --production windows-build-tools --vs2015
(note the--vs2015
)For my case, i just want to install bcrypt in angular 8 app, here is how is the story i finally get it work:
First, this is what the error I get:
It say can’t find python, then I try run this in administrator terminal:
Then i try install bcrypt, i get some header files missing:
After google, i get my Windows 10 SDK via Visual Studio Installer
Then i try again install bcrypt, get another error “MSBUILD : error MSB4025: The project file could not be loaded. Root element is missing”, which lead me here:
Finally, i run this command from https://github.com/nodejs/node-gyp/issues/1144#issuecomment-450620159, it get me works:
Result:
@Noxillio
#1691 Is the same problem. For me the solution was to
npm config delete msvs_version
andnpm config delete msvs_version -g
@himadrinath Ohh man, what a hard first time. I’ve seen like 100,000 package installs first time it’s so hard. If you are a bug magnet I want to hire you as QA 😜
@refack i don’t know how to thank you. it’s been more then 5 to 7 days i was trying to solve it. this is my first time in node and first package i installed. thank you is not enough…
So who really solved this problem and how? I’ve tried everything still this error.
VS 2017 isn’t supported yet (see WIP in #1130) but if you install 2015 and pass
--msvs_version=2015
, it should work.As @MadOPcode already pointed out,
KeyError: '2017'
is present in 3.8.0. Quite sure this error did not occur in the past.Windows 10, VS2017, Python2.7 installed.
I performed all suggested actions, including uninstalling all the Windows for UWP, x64 and x86, etc. toolkits.
Run of node-gyp configure --verbose in some directory:
gyp info it worked if it ends with ok gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe', gyp verb cli '...\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js', gyp verb cli 'configure', gyp verb cli '--verbose' ] gyp info using node-gyp@3.8.0 gyp info using node@10.15.0 | win32 | x64 gyp verb command configure [] gyp verb check python checking for Python executable "python2" in the PATH gyp verb `which` failed Error: not found: python2 gyp verb `which` failed at getNotFoundError (...\npm\node_modules\node-gyp\node_modules\which\which.js:13:12) gyp verb `which` failed at F (...\npm\node_modules\node-gyp\node_modules\which\which.js:68:19) gyp verb `which` failed at E (...\npm\node_modules\node-gyp\node_modules\which\which.js:80:29) gyp verb `which` failed at ...\npm\node_modules\node-gyp\node_modules\which\which.js:89:16 gyp verb `which` failed at ...\npm\node_modules\node-gyp\node_modules\isexe\index.js:42:5 gyp verb `which` failed at ...\npm\node_modules\node-gyp\node_modules\isexe\windows.js:36:5 gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21) gyp verb `which` failed python2 { Error: not found: python2 gyp verb `which` failed at getNotFoundError (...\npm\node_modules\node-gyp\node_modules\which\which.js:13:12) gyp verb `which` failed at F (...\npm\node_modules\node-gyp\node_modules\which\which.js:68:19) gyp verb `which` failed at E (...\npm\node_modules\node-gyp\node_modules\which\which.js:80:29) gyp verb `which` failed at ...\npm\node_modules\node-gyp\node_modules\which\which.js:89:16 gyp verb `which` failed at ...\npm\node_modules\node-gyp\node_modules\isexe\index.js:42:5 gyp verb `which` failed at ...\npm\node_modules\node-gyp\node_modules\isexe\windows.js:36:5 gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21) gyp verb `which` failed stack: gyp verb `which` failed 'Error: not found: python2 at getNotFoundError (...\\npm\\node_modules\\node-gyp\\node_modules\\which\\which.js:13:12) at F (...\\npm\\node_modules\\node-gyp\\node_modules\\which\\which.js:68:19)\n at E (...\\npm\\node_modules\\node-gyp\\node_modules\\which\\which.js:80:29) at ...\\npm\\node_modules\\node-gyp\\node_modules\\which\\which.js:89:16 at ...\\npm\\node_modules\\node-gyp\\node_modules\\isexe\\index.js:42:5 at ...\\npm\\node_modules\\node-gyp\\node_modules\\isexe\\windows.js:36:5 at FSReqWrap.oncomplete (fs.js:154:21)', gyp verb `which` failed code: 'ENOENT' } gyp verb check python checking for Python executable "python" in the PATH gyp verb `which` succeeded python C:\Python27\python.EXE gyp verb check python version `C:\Python27\python.EXE -c "import sys; print "2.7.14 gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j gyp verb get node dir no --target version specified, falling back to host node version: 10.15.0 gyp verb command install [ '10.15.0' ] gyp verb install input version string "10.15.0" gyp verb install installing version: 10.15.0 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version is already installed, need to check "installVersion" gyp verb got "installVersion" 9 gyp verb needs "installVersion" 9 gyp verb install version is good gyp verb get node dir target node version installed: 10.15.0 gyp verb build dir attempting to create "build" dir: C:\WINDOWS\system32\build gyp verb build dir "build" dir needed to be created? C:\WINDOWS\system32\build gyp verb Not using VS2017: Could not use PowerShell to find VS2017 And goes on to complain that this directory actually is not a node project.