For the last few days I've been trying to get node/npm installed on my Windows 10 VM and I've tried everything I found with no success.
I followed the node-gyp setup instructions for Windows which say to install Python3.7. The npm microsoft-build-tools are now deprecated and installed with the microsoft installer (which I used). i also installed the tool through visual studio, and tried npm config set msvs_version 2015 -g
to try both 2015/2017. I have node -v v16.13.1
, node-gyp -v v8.4.1
, npm 8.2
. Everytime I try npm install
I just keep getting the same stacktrace
C:\Users\dperrone1\Desktop\project\node_modules\libxslt
npm ERR! command failed
LINK : fatal error LNK1181: cannot open input file 'C:\Users\dperrone1\Desktop\project\node_modules\node1-libxmljsmt-myh\build\Release\xmljs-myh.lib' [C:\Users\dperrone1\Desktop\project\node_modules\libxslt\build\node-libxslt.vcxproj]
npm ERR! gyp info find Python using Python version 3.10.1 found
gyp info find VS using VS2017 (15.9.28307.1745) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
"C:\\Users\\dperrone1\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\dperrone1\Desktop\project\node_modules\libxslt
none of the solutions around npm rebuild/deleting node_modules work, because after npm install
fails it wipes away the node_modules it added. any suggestions please? anyway to use an alternative library?
Fixed: the problem turned out not to be the build tools themselves, but the modules the build tools were trying to build. I remove the dependencies libxslt
, xml
, xml-parser
, xml2js
, and xmltojson
. The core issue was libxslt
and for some reason npm was trying to find a non existent fork of this module. I had the same issues trying to install this on WSL, but removing those packages fixes it all around
Fixed: the problem turned out not to be the build tools themselves, but the modules the build tools were trying to build. I remove the dependencies libxslt, xml, xml-parser, xml2js, and xmltojson. The core issue was libxslt and for some reason npm was trying to find a non existent fork of this module. I had the same issues trying to install this on WSL, but removing those packages fixes it all around
Problem is python and your VS tools. On windows worked for me:
Uninstall node.js
Uninstall python
Uninstall VS build tools
Clear registry Then reboot your machine and try install with following ordering:
Then reboot your machine. Try to run npm install
Also try to not use npm install from desktop.
It's preferable to post your package json.
This problem has been bothering me, but I put node JS version down to 12.13.0 to solve the headache
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.