windows10 node-gyp安装

2021-01-18 00:12

阅读:511

标签:IPFS   using   ref   win   enc   VS2017   sdn   dep   inf   

本机环境:win10,已安装vs2017,Node版本 10.13.0

1、安装node-gyp

npm install -g node-gyp

2、安装完毕之后node-gyp list看一下

node-gyp list

显示如下

E:\IPFS\js-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:\IPFS\js-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:\Users\JiXiaoHua\.node-gyp\10.13.0\x64\node.lib : fatal error LNK1107: 文件无效或损坏

看来只好手动下载一下看,下载地址:https://nodejs.org/download/release/v10.13.0/win-x64/node.lib

然后放到上一步提示报错的位置,替换掉残缺的文件,再次运行编译,成功!

4、最后node-gyp list看一下

node-gyp list

显示如下

E:\IPFS\js-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安装

标签:IPFS   using   ref   win   enc   VS2017   sdn   dep   inf   

原文地址:https://www.cnblogs.com/jixiaohua/p/12189713.html


评论


亲,登录后才可以留言!