因为最近升级了node,所以运行Vue项目 npm run serve 的时候报如下错误:

error  in ./node_modules/vue-loading-spinner/src/components/RotateSquare5.vue?vue&type=style&index=0&id=fa2cf838&lang=scss&scoped=true&

Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Missing binding /Users/xxx/node_modules/node-sass/vendor/darwin-x64-83/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 14.x

Found bindings for the following environments:
  - OS X 64-bit with Node.js 11.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
    at module.exports (/Users/xxx/node_modules/node-sass/lib/binding.js:15:13)
    at Object.<anonymous> (/Users/xxx/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/xxx/node_modules/sass-loader/lib/loader.js:3:14)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at loadLoader (/Users/xxx/node_modules/loader-runner/lib/loadLoader.js:18:17)

在这里插入图片描述
解决方法:

上面报错内容已提示,在终端输入

npm rebuild node-sass 

npm i node-sass

下载 node-sass 后,重新运行即可

所以遇到报错不要慌,先看提示,如果实在搞不定直接上网查,总能找到解决方法滴!

我的个人博客有空来坐坐

https://www.wangyanan.online

Logo

前往低代码交流专区

更多推荐