在使用npm 安装依赖时,执行到
Missing binding E:\webstorm\notepad\notepad\node_modules\node-sass\vendor\win32-x64-46\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 10.x
时报错,下载node-sass时无响应;
下面是部分错误信息:
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.0/win32-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.13.0/win32-x64-64_binding.node":
ESOCKETTIMEDOUT
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
> [email protected] postinstall D:\work\xiangmu\heb-metro-operator-page\node_modules\@babel\polyfill\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> [email protected] postinstall D:\work\xiangmu\heb-metro-operator-page\node_modules\babel-polyfill\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> [email protected] postinstall D:\work\xiangmu\heb-metro-operator-page\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> [email protected] postinstall D:\work\xiangmu\heb-metro-operator-page\node_modules\core-js
> node postinstall || echo "ignore"
> [email protected] postinstall D:\work\xiangmu\heb-metro-operator-page\node_modules\core-js-pure
> node postinstall || echo "ignore"
> [email protected] postinstall D:\work\xiangmu\heb-metro-operator-page\node_modules\ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
> [email protected] postinstall D:\work\xiangmu\heb-metro-operator-page\node_modules\swiper
> node -e "console.log('\u001b[35m\u001b[1mLove Swiper? Support Vladimir\'s work by donating or pledging on patreon:\u001b[22m\u001b[39m\n > \u001b[32mhttps://patreon.com/vladimirkharlampidi\u001b[0m\n')"
Love Swiper? Support Vladimir's work by donating or pledging on patreon:
> https://patreon.com/vladimirkharlampidi
> [email protected] postinstall D:\work\xiangmu\heb-metro-operator-page\node_modules\node-sass
> node scripts/build.js
Building: C:\Program Files\nodejs\node.exe D:\work\xiangmu\heb-metro-operator-page\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli 'D:\\work\\xiangmu\\heb-metro-operator-page\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
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 (D:\work\xiangmu\heb-metro-operator-page\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (D:\work\xiangmu\heb-metro-operator-page\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (D:\work\xiangmu\heb-metro-operator-page\node_modules\which\which.js:80:29)
gyp verb `which` failed at D:\work\xiangmu\heb-metro-operator-page\node_modules\which\which.js:89:16
gyp verb `which` failed at D:\work\xiangmu\heb-metro-operator-page\node_modules\isexe\index.js:42:5
gyp verb `which` failed at D:\work\xiangmu\heb-metro-operator-page\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed python2 { Error: not found: python2
gyp verb `which` failed at getNotFoundError (D:\work\xiangmu\heb-metro-operator-page\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (D:\work\xiangmu\heb-metro-operator-page\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (D:\work\xiangmu\heb-metro-operator-page\node_modules\which\which.js:80:29)
gyp verb `which` failed at D:\work\xiangmu\heb-metro-operator-page\node_modules\which\which.js:89:16
gyp verb `which` failed at D:\work\xiangmu\heb-metro-operator-page\node_modules\isexe\index.js:42:5
gyp verb `which` failed at D:\work\xiangmu\heb-metro-operator-page\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:153:21)
分析了好久,没有找到原因,后来注意到了下载地址是github 的文件地址,突然想起来github文件下载缓慢或无响应,于是试着解决了下,发现问题居然消失了;
下面贴我的解决方法:
第一步,打开本机上的Hosts文件
首先,什么是Hosts文件?
在互联网协议中,host表示能够同其他机器互相访问的本地计算机。一台本地机有唯一标志代码,同网络掩码一起组成IP地址,如果通过点到点协议通过ISP访问互联网,那么在连接期间将会拥有唯一的IP地址,这段时间内,你的主机就是一个host。
在这种情况下,host表示一个网络节点。host是根据TCP/IP for Windows 的标准来工作的,它的作用是包含IP地址和Host name(主机名)的映射关系,是一个映射IP地址和Host name(主机名)的规定,规定要求每段只能包括一个映射关系,IP地址要放在每段的最前面,空格后再写上映射的Host name主机名 。对于这段的映射说明用“#”分割后用文字说明。
Hosts文件的路径是:
C:\Windows\System32\drivers\etc
由于文件没有后缀名,可以利用鼠标右键点击,选择用记事本打开
第二步,追加域名的IP地址
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
10.170.1.149 windows10.microdone.cn
保存。
第三步,刷新 DNS 缓存
在终端或CMD中,执行以下命令:
ipconfig /flushdns
之后再重新安装依赖就ok了。
标签:npm,node,sass,work,modules,js,verb,gyp From: https://www.cnblogs.com/ZerlinM/p/16969094.html