node-sass版本太低导致dev运行失败

时间:2024-05-21 19:48:55

94% asset optimization

ERROR Failed to compile with 2 errors 13:37:18

error in ./src/base/components/head.vue

Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (72)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.7.2
at module.exports (E:\xuecheng_edu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\node-sass\lib\binding.js:13:13)
at Object. (E:\xuecheng_edu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (E:\xuecheng_edu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\sass-loader\lib\loader.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at loadLoader (E:\xuecheng_edu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\loader-runner\lib\loadLoader.js:13:17)

@ ./node_modules/vue-style-loader!./node_modules/css-loader?{“sourceMap”:false}!./node_modules/vue-loader/lib/style-compiler?{“vue”:true,“id”:“data-v-1340bee1”,“scoped”:true,“hasInlin
eConfig”:false}!./node_modules/sass-loader/lib/loader.js?{“sourceMap”:false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/base/components/head.vue 4:14
-395 13:3-17:5 14:22-403
@ ./src/base/components/head.vue
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/module/home/page/home.vue
@ ./src/module/home/page/home.vue
@ ./src/module/home/router/index.js
@ ./src/base/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:11000 webpack/hot/dev-server ./src/main.js

error in ./src/module/home/page/home.vue

Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (72)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.7.2
at module.exports (E:\xuecheng_edu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\node-sass\lib\binding.js:13:13)
at Object. (E:\xuecheng_edu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (E:\xuecheng_edu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\sass-loader\lib\loader.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at loadLoader (E:\xuecheng_edu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\loader-runner\lib\loadLoader.js:13:17)

@ ./node_modules/vue-style-loader!./node_modules/css-loader?{“sourceMap”:false}!./node_modules/vue-loader/lib/style-compiler?{“vue”:true,“id”:“data-v-4d72bda9”,“scoped”:true,“hasInlin
eConfig”:false}!./node_modules/sass-loader/lib/loader.js?{“sourceMap”:false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/module/home/page/home.vue 4:1
4-407 13:3-17:5 14:22-415
@ ./src/module/home/page/home.vue
@ ./src/module/home/router/index.js
@ ./src/base/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:11000 webpack/hot/dev-server ./src/main.js

运行报错如上,主要是由于node-sass版本太低了,需要更新node-sass,那么有以下两种方案:个人体验而言建议方案二

方案一:

先卸载

cnpm uninstall node-sass -g

然后再安装新的

cnpm install node-sass -g

这里建议用cnpm国内的比较好,用npm可能会网速很慢,导致更新会很慢

node-sass版本太低导致dev运行失败

方案二:

直接在webstrom内部直接修改版本
直接用ctrl + f搜索node-sass,就可以找到了,然后改成自己想要的版本号,右下角就会提示是否更新依赖配置。
node-sass版本太低导致dev运行失败
控制台信息如下:
node-sass版本太低导致dev运行失败
最后成功解决,重新运行,成功信息如下:
node-sass版本太低导致dev运行失败