vue在安装时 node-sass报错

2022年6月29日11:14:36

具体报错如下:

npmERR! node-sass@4.13.1 postinstall:`node scripts/build.js`
npmERR! Exit status1
npmERR!
npmERR! Failed at the node-sass@4.13.1 postinstall script.
npmERR! This is probably not a problemwith npm. There is likely additional logging output above.

npmERR!A complete logofthis run can be foundin:
npmERR!C:\Users\32008\AppData\Roaming\npm-cache\_logs\2021-05-30T08_34_40_264Z-debug.log

解决方案

1.安装cnpm

npm install-g cnpm-registry=https://registry.npm.taobao.org

安装成功可输入命令查看:cnpm -v

C:\Users\32008>cnpm-v
cnpm@6.2.0(C:\Users\32008\AppData\Roaming\npm\node_modules\cnpm\lib\parse_argv.js)
npm@6.14.13(C:\Users\32008\AppData\Roaming\npm\node_modules\cnpm\node_modules\npm\lib\npm.js)
node@14.15.4(E:\前端\node\node.exe)
npminstall@3.28.0(C:\Users\32008\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\index.js)
prefix=C:\Users\32008\AppData\Roaming\npm
win32 x6410.0.19042
registry=https://registry.nlark.com

2.卸载node-sass:npm uninstall node-sass

E:\java\Git\renren-fast-vue>npm uninstall node-sass
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\jest.ps1 as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\jest-cli
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\jest.cmd as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\jest-cli
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\jest as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\jest-cli
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\gulp.ps1 as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\gulp-cli
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\gulp.cmd as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\gulp-cli
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\gulp as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\gulp-cli
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\shjs.ps1 as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_shelljs@0.7.8@shelljs
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\shjs.cmd as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_shelljs@0.7.8@shelljs
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\shjs as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_shelljs@0.7.8@shelljs
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\semver.ps1 as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_semver@5.7.1@semver
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\semver.cmd as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_semver@5.7.1@semver
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\semver as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_semver@5.7.1@semver
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\rimraf.ps1 as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_rimraf@2.7.1@rimraf
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\rimraf.cmd as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_rimraf@2.7.1@rimraf
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\rimraf as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_rimraf@2.7.1@rimraf
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\rimraf.ps1 as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_rimraf@2.6.3@rimraf
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\rimraf.cmd as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_rimraf@2.6.3@rimraf
npm WARN rmnot removing E:\java\Git\renren-fast-vue\node_modules\.bin\rimraf as it wasn't installed by E:\java\Git\renren-fast-vue\node_modules\_rimraf@2.6.3@rimraf

3.重新安装node-sass:cnpm install node-sass

E:\java\Git\renren-fast-vue>cnpm install node-sass
√ Installed1 packages
√ Linked176 latest versions[1/1] scripts.install node-sass@* run"node scripts/install.js", root:"E:\\java\\Git\\renren-fast-vue\\node_modules\\_node-sass@6.0.0@node-sass"
Cached binary found at C:\Users\32008\.npminstall_tarball\node-sass\6.0.0\win32-x64-83_binding.node[1/1] scripts.install node-sass@* finishedin442ms[1/1] scripts.postinstall node-sass@* run"node scripts/build.js", root:"E:\\java\\Git\\renren-fast-vue\\node_modules\\_node-sass@6.0.0@node-sass"
Binary found at E:\java\Git\renren-fast-vue\node_modules\_node-sass@6.0.0@node-sass\vendor\win32-x64-83\binding.node
Testing binary
Binary is fine[1/1] scripts.postinstall node-sass@* finishedin161ms
√ Run1 scripts
deprecate node-sass@6.0.0 › request@^2.88.0 request has been deprecated, see https://github.com/request/request/issues/3142
deprecate node-sass@6.0.0 › request@2.88.2 › har-validator@~5.1.3 this library is no longer supported
Recently updated(since2021-05-23):1 packages(detail see file E:\java\Git\renren-fast-vue\node_modules\.recently_updates.txt)
√ All packages installed(192 packages installed from npm registry, used6s(network5s), speed72.53kB/s, json177(365.18kB), tarball0B)
  • 作者:快乐小炮灰
  • 原文链接:https://blog.csdn.net/qq_46237746/article/details/117400047
    更新时间:2022年6月29日11:14:36 ,共 5051 字。