npm install报错:ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1
程序员文章站
2022-05-29 09:35:31
...
npm install 运行,报错如下:
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (D:\project\vue-cli3 demo\node_modules\node-gyp\l
ib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\project\\vue-cli3 demo\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "
--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\project\vue-cli3 demo\node_modules\node-sass
gyp ERR! node -v v14.15.1
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]1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]1.2.11: wante
d {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-[email protected]4.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-[email protected]4.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output a
bove.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\小蠢蛋\AppData\Roaming\npm-cache\_logs\2021-04-02T01_28_44_774Z-debug.l
og
试过了 如下办法:
删除 .node-gyp/
执行 npm i -g node-gyp
删除 项目/node_modules
执行 npm i -d
最后 发现是 node-sass 安装源的问题,运行如下:
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
成功
上一篇: 怎样安装NPM离线包