目录

Module build failed: Error: Node Sass does not yet support your current environment

问题概述

公司的项目想跑一下前端,执行npm install报错

./1.jpg

再执行npm audit fix还报错

./2.jpg

查看对应的日志目录发现里面报错,"Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime",提示系统的node-sass不被支持的,截图如下:

./3.png

具体内容如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
 ERROR  Failed to compile with 6 errors                                                                               下午4:01:38
 
 error  in ./src/assets/scss/index.scss
 
Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (83)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.13.1
    at module.exports (E:\code\VSCode_Code\renren-fast-vue\node_modules\node-sass\lib\binding.js:13:13)
    at Object.<anonymous> (E:\code\VSCode_Code\renren-fast-vue\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> (E:\code\VSCode_Code\renren-fast-vue\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 (E:\code\VSCode_Code\renren-fast-vue\node_modules\loader-runner\lib\loadLoader.js:18:17)
 
 @ ./src/assets/scss/index.scss 4:14-212 13:3-17:5 14:22-220
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8001 webpack/hot/dev-server babel-polyfill ./src/main.js
 
 error  in ./src/views/modules/sys/menu-add-or-update.vue
 
Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (83)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.13.1
    at module.exports (E:\code\VSCode_Code\renren-fast-vue\node_modules\node-sass\lib\binding.js:13:13)
    at Object.<anonymous> (E:\code\VSCode_Code\renren-fast-vue\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> (E:\code\VSCode_Code\renren-fast-vue\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 (E:\code\VSCode_Code\renren-fast-vue\node_modules\loader-runner\lib\loadLoader.js:18:17)
 
 @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-1ed9424a","scoped":false,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/views/modules/sys/menu-add-or-update.vue 
4:14-422 13:3-17:5 14:22-430
 @ ./src/views/modules/sys/menu-add-or-update.vue
 @ ./src/views ^\.\/.*\.vue$
 @ ./src/router/import-development.js
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8001 webpack/hot/dev-server babel-polyfill ./src/main.js
 
 error  in ./src/views/common/login.vue
 
Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (83)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.13.1
    at module.exports (E:\code\VSCode_Code\renren-fast-vue\node_modules\node-sass\lib\binding.js:13:13)
    at Object.<anonymous> (E:\code\VSCode_Code\renren-fast-vue\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> (E:\code\VSCode_Code\renren-fast-vue\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 (E:\code\VSCode_Code\renren-fast-vue\node_modules\loader-runner\lib\loadLoader.js:18:17)
 
 @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-20137d6c","scoped":false,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/views/common/login.vue 4:14-397 13:3-17:5 14:22-405
 @ ./src/views/common/login.vue
 @ ./src/views ^\.\/.*\.vue$
 @ ./src/router/import-development.js
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8001 webpack/hot/dev-server babel-polyfill ./src/main.js

解决办法

经过BUG的诊断,发现是当前系统下的Node版本过高导致的,

注意编译报错内容提示,当前的node-sass是不被支持的,

再查看错误日志中的一行:https://github.com/sass/node-sass/releases/tag/v4.13.1,如下图:

./4.png

当前系统的node版本为v4.13.1,如下图:

./5.png

而当前node-sass支持的最高版本为13,如下图:

./6.png

所以,最终找到问题的所在了,是因为系统的Node版本过高导致的编译异常,只需要将版本降低到13,在重新build一下node-sass就可以了,输入指令:npm rebuild node-sass即可,