npm报错:Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 10.x

npm报错:Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime

异常信息

Module build failed: Error: Missing binding D:\wps工单系统\wps\node_modules\node-sass\vendor\win32-x64-64\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 10.x

Found bindings for the following environments:
  - Windows 64-bit with Node.js 12.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 (D:\wps工单系统\wps\node_modules\node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (D:\wps工单系统\wps\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.sassLoader (D:\wps工单系统\wps\node_modules\sass-loader\lib\loader.js:46:72)

 @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"optionsId":"0","vue":true,"id":"data-v-f076e348","scoped":true,"sourceMap":true}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/element-rx/components/Index/MainCenter/Lesson1.vue 4:14-423 13:3-17:5 14:22-431
 @ ./src/element-rx/components/Index/MainCenter/Lesson1.vue
 @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/element-rx/components/Index/MainCenter/MainCenter.vue
 @ ./src/element-rx/components/Index/MainCenter/MainCenter.vue
 @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/element-rx/components/Index/Index.vue
 @ ./src/element-rx/components/Index/Index.vue
 @ ./src/element-rx/coreRouter/index.js
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js babel-polyfill

之前使用 Node.js 8 创建的 vue 项目,升级 Node.js 12 后,执行 npm run serve 后报错。删除 node_modules 目录,重新执行 npm install 和 npm rebuild 后都没有解决。

解决方法

卸载旧版本 node-sass 并安装最新版本

npm uninstall --save node-sass
npm install --save-dev node-sass
-------------已经触及底线 感谢您的阅读-------------
posted @ 2020-10-11 22:44  趙小傑  阅读(816)  评论(0编辑  收藏  举报