windows10 node-gyp安装
Posted jixiaohua
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows10 node-gyp安装相关的知识,希望对你有一定的参考价值。
本机环境:win10,已安装vs2017,Node版本 10.13.0
1、安装node-gyp
npm install -g node-gyp
2、安装完毕之后node-gyp list看一下
node-gyp list
显示如下
E:IPFSjs-ipfs-http-client>node-gyp list gyp info it worked if it ends with ok gyp info using node-gyp@6.1.0 gyp info using node@10.13.0 | win32 | x64 No node development files installed. Use `node-gyp install` to install a version. gyp info ok
没有开发环境相关文件,提示使用 node-gyp install安装
3、node-gyp install安装头文件和静态库
node-gyp install
显示如下
E:IPFSjs-ipfs-http-client>node-gyp install gyp info it worked if it ends with ok gyp info using node-gyp@6.1.0 gyp info using node@10.13.0 | win32 | x64 gyp http GET https://nodejs.org/download/release/v10.13.0/node-v10.13.0-headers.tar.gz gyp http 200 https://nodejs.org/download/release/v10.13.0/node-v10.13.0-headers.tar.gz gyp http GET https://nodejs.org/download/release/v10.13.0/SHASUMS256.txt gyp http GET https://nodejs.org/download/release/v10.13.0/win-x86/node.lib gyp http GET https://nodejs.org/download/release/v10.13.0/win-x64/node.lib gyp http GET https://nodejs.org/download/release/v10.13.0/win-arm64/node.lib gyp http 200 https://nodejs.org/download/release/v10.13.0/SHASUMS256.txt gyp http 200 https://nodejs.org/download/release/v10.13.0/win-x64/node.lib gyp http 200 https://nodejs.org/download/release/v10.13.0/win-x86/node.lib gyp http 404 https://nodejs.org/download/release/v10.13.0/win-arm64/node.lib
最后一个静态库404了,找不到,拿出链接浏览器访问一下果然如此
然后编译文件时就会报错
C:UsersJiXiaoHua.node-gyp10.13.0x64 ode.lib : fatal error LNK1107: 文件无效或损坏
看来只好手动下载一下看,下载地址:https://nodejs.org/download/release/v10.13.0/win-x64/node.lib
然后放到上一步提示报错的位置,替换掉残缺的文件,再次运行编译,成功!
4、最后node-gyp list看一下
node-gyp list
显示如下
E:IPFSjs-ipfs-http-client>node-gyp list gyp info it worked if it ends with ok gyp info using node-gyp@6.1.0 gyp info using node@10.13.0 | win32 | x64 10.13.0 gyp info ok
一切OK!
5、一点补充
不再纠结devDependencies与dependencies
以上是关于windows10 node-gyp安装的主要内容,如果未能解决你的问题,请参考以下文章
Windows npm install node-gyp 错误:libxslt 命令失败