首页 前端知识 cnpm i报错:node-sass@^6.0.1 run postinstall node scripts/build.js error

cnpm i报错:node-sass@^6.0.1 run postinstall node scripts/build.js error

2024-05-09 10:05:10 前端知识 前端哥 850 901 我要收藏

1. 错误描述

PS D:\VueProjects\xxx> cnpm i     
| [32/34] Installing tslib@2.3.0
[npminstall:runscript:error] node-sass@^6.0.1 run postinstall node scripts/build.js error: Error: Command failed with exit code 1: node scripts/build.js
    at makeError (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\execa\lib\error.js:60:11)
    at handlePromise (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\execa\index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async exports.runScript (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\utils.js:261:12)
    at async runLifecycleScripts (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\lifecycle_scripts.js:66:7)
    at async _install (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\install_package.js:321:5)
    at async install (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\install_package.js:23:12)
    at async _installOne (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\local_install.js:215:15)
    at async mapper (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\local_install.js:140:5) {
  shortMessage: 'Command failed with exit code 1: node scripts/build.js',
  command: 'node scripts/build.js',
  escapedCommand: 'node "scripts/build.js"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
× Install fail! Error: run postinstall error, please remove node_modules before retry!
Command failed with exit code 1: node scripts/build.js
Error: Command failed with exit code 1: node scripts/build.js
    at makeError (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\execa\lib\error.js:60:11)
    at handlePromise (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\execa\index.js:118:26)
    at async exports.runScript (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\utils.js:261:12)
    at async runLifecycleScripts (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\lifecycle_scripts.js:66:7)
    at async _install (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\install_package.js:321:5)
    at async install (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\install_package.js:23:12)
    at async _installOne (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\local_install.js:215:15)
    at async mapper (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\local_install.js:140:5)
npminstall version: 7.11.1
npminstall argv: C:\Program Files\nodejs\node.exe C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\Administrator\.cnpmrc --distu
rl=https://cdn.npmmirror.com/binaries/node --registry=https://registry.npmmirror.com

2. 解决办法

PS D:\VueProjects\xxx> cnpm install node-sass@npm:sass --ignore-scripts
√ Linked 1 latest versions fallback to D:\VueProjects\hotel-stay-web\node_modules\.store\node_modules                             
√ Installed 1 packages on D:\VueProjects\hotel-stay-web                                                                           
√ All packages installed (used 65ms(network 62ms), speed 0B/s, json 0(0B), tarball 0B, manifests cache hit 1, etag hit 0 / miss 0)
                                                                                                                                  
dependencies:                                                                                                                     
+ node-sass npm:sass               
转载请注明出处或者链接地址:https://www.qianduange.cn//article/7667.html
标签
sass
评论
会员中心 联系我 留言建议 回顶部
复制成功!