1、错误描述
[编译scss/sass] 15:48:25.231 internal/modules/cjs/loader.js:717
[编译scss/sass] 15:48:25.231 return process.dlopen(module, path.toNamespacedPath(filename));
[编译scss/sass] 15:48:25.231 ^
[编译scss/sass] 15:48:25.231 Error: \\?\G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\vendor\win32-x64-64\binding.node is not a valid Win32 application.
[编译scss/sass] 15:48:25.231 \\?\G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\vendor\win32-x64-64\binding.node
[编译scss/sass] 15:48:25.231 at Object.Module._extensions..node (internal/modules/cjs/loader.js:717:18)
[编译scss/sass] 15:48:25.231 at Module.load (internal/modules/cjs/loader.js:598:32)
[编译scss/sass] 15:48:25.231 at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
[编译scss/sass] 15:48:25.231 at Function.Module._load (internal/modules/cjs/loader.js:529:3)
[编译scss/sass] 15:48:25.231 at Module.require (internal/modules/cjs/loader.js:636:17)
[编译scss/sass] 15:48:25.231 at require (internal/modules/cjs/helpers.js:20:18)
[编译scss/sass] 15:48:25.231 at module.exports (G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\lib\binding.js:19:10)
[编译scss/sass] 15:48:25.231 at Object.<anonymous> (G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\lib\index.js:14:35)
[编译scss/sass] 15:48:25.231 at Module._compile (internal/modules/cjs/loader.js:688:30)
[编译scss/sass] 15:48:25.231 at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
[编译scss/sass] 15:56:14.903 [0;31m--> LibSass 的二进制文件(G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\vendor\win32-x64-64\binding.node)缺失,请执行下面3条命令下载对应版本的二进制文件:(有可能引发此错误的原因是 Node 版本变更)[0m
[编译scss/sass] 15:56:14.903 mkdir -p G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\vendor\win32-x64-64
[编译scss/sass] 15:56:14.903 cd G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\vendor\win32-x64-64
[编译scss/sass] 15:56:14.903 curl -o binding.node http://cdn.npm.taobao.org/dist/node-sass/v4.7.2/win32-x64-64_binding.node
[编译scss/sass] 15:56:14.903 [0;31m--> MacOS 、Unix/Linux 请根据权限使用 sudo [0m
2、错误原因
由于G:\HBuilderX\plugins\compile-node-sass\node_modules\node-sass-china\vendor\win32-x64-64\binding.node文件的版本不对,导致出现报错
3、解决办法
使用以下命令查看对应的版本,然后到https://github.com/sass/node-sass/releases下载对应的版本,注意需要把文件名称修改成binding.node
node -p "[process.platform, process.arch, process.versions.modules].join('-')"
C:\Users\Administrator.USER-0GUONPPBHK>node -p "[process.platform, process.arch,
process.versions.modules].join('-')"
win32-x64-64
C:\Users\Administrator.USER-0GUONPPBHK>