关于npm install 出现
Failed in 911ms at F:\Sert-Vue-master\vue\node_modules\.pnpm\[email protected]\node_modules\node-sass
ELIFECYCLE Command failed with exit code 1.
最开始从GitHub拉了一个项目,然后 npm i 的时候出现了报错
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1 :345:16) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:292:12) npm ERR! gyp ERR! System Windows_NT 10.0.19045 npm ERR! gyp ERR! command "F:\\nvm-win\\nodejs\\node.exe" "F:\\baiyunTestMay\\SpringBoot-Shiro-Vue-master\\vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" npm ERR! gyp ERR! cwd F:\baiyunTestMay\SpringBoot-Shiro-Vue-master\vue\node_modules\node-sass npm ERR! gyp ERR! node -v v18.18.0 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! not ok npm ERR! Build failed with error code: 1 npm ERR! A complete log of this run can be found in: C:\Users\ASUS\AppData\Local\npm-cache\_logs\2024-05-28T01_01_57_860Z-debug-0.log
看到后第一想法是清楚缓存
npm cache clean --force
然后重试,还是报错,尝试使用pnpm install
└─ Failed in 911ms at F:\Sert-Vue-master\vue\node_modules\.pnpm\[email protected]\node_modules\node-sass
ELIFECYCLE Command failed with exit code 1.
开始出现另一个错误
看到sass的问题,直接下载最新版
pnpm add node-sass@latest
下载完再次pnpm install 也成功了,但是run的时候出现了新的报错
To install them, you can run: npm install --save babel-runtime/core-js/get-iterator babel-runtime/core-js/object/keys babel-runtime/core-js/promise babel-runtime/helpers/extends babel-runtime/helpers/slicedToArray babel-runtime/helpers/toConsumableArray svg-baker-runtime/browser-symbol vue-hot-reload-api
他的意思是要单独下这几个包
pnpm install --save babel-runtime
pnpm install --save baker-runtime
pnpm install --save regenerator-runtime svg-baker-runtime vue-style-loader
pnpm install --save vue-hot-reload-api
但是在下载的过程中出现了错误:
ERR_PNPM_META_FETCH_FAIL GET https://registry.npmjs.org/babel-runtime: request to https://registry.npmjs.org/babel-runtime failed, reason: connect ETIMEDOUT 104.16.1.35:443
意思是连接不上这个地址,开启氪学上网下载,最后清理pnpm缓存后重新下载,下载成功后run便成功了。
标签:node,npm,sass,ERR,--,modules,gyp,runtime From: https://www.cnblogs.com/ai377377/p/18217528