node-sass安装失败解决

报如下错误:

gyp ERR! configure error
gyp ERR! stack Error: unable to verify the first certificate
gyp ERR! stack     at TLSSocket. (_tls_wrap.js:1103:38)
gyp ERR! stack     at emitNone (events.js:106:13)
gyp ERR! stack     at TLSSocket.emit (events.js:208:7)
gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:637:8)
gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\pc\\Desktop\\xxx\\
i\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\pc\Desktop\xxx\node_modules\node-sass
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\pc\AppData\Roaming\npm-cache\_logs\2018-11-05T11_16_24_792Z-debug.log

网上改了源操作都不行的话可以这样
去github手动下载
但要先 npm install 看下他下载的是哪个版本后
https://github.com/sass/node-sass/releases
到这里去下载
下载完成后指定环境变量

export SASS_BINARY_PATH=/home/xxx/linux-x64-xx_binding.node

windows 和linux都可以这么解决

你可能感兴趣的:(小技巧)