降级了自己的macos系统后, 发现原来的redis管理工具不能用了, 索性就下载源码来自己编译一个redis的工具, 在npm run build 后居然来个 Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (93) , 这个明显的就是当前项目里面的这个 node-sass 包和我当前的系统不匹配导致的.
异常代码
Entrypoint mini-css-extract-plugin = *
[./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/renderer/windows/MainWindow/InstanceContent/DatabaseContainer/Content/TabBar/index.scss] 1.22 KiB {mini-css-extract-plugin} [built] [failed] [1 error]
ERROR in ./src/renderer/windows/MainWindow/InstanceContent/DatabaseContainer/Content/TabBar/index.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/renderer/windows/MainWindow/InstanceContent/DatabaseContainer/Content/TabBar/index.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (93)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
at module.exports (/opt/tools/medis/node_modules/node-sass/lib/binding.js:13:13)
at Object.<anonymous> (/opt/tools/medis/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (/opt/tools/medis/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
at Module.require (node:internal/modules/cjs/loader:1100:19)
at require (/opt/tools/medis/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at getDefaultSassImpl (/opt/tools/medis/node_modules/sass-loader/dist/index.js:198:10)
at Object.loader (/opt/tools/medis/node_modules/sass-loader/dist/index.js:80:29)
解决方法
首先先查看一下官方文档说明https://www.npmjs.com/package/node-sass,看看这里的版本要求后,在对照自己当前的node环境, 将 这个node-sass降级到一个相对较低的版本.
结果查看项目的package.json中的版本得知原来的版本是 "node-sass": "^4.12.0", 再通过官方发行文档发现 这个包在node v10的情况下版本的要求为大于4.9.0 小于6.0, 在看看这个包的版本发行日志发现比4.12.0小的版本为 4.11.0 , 4.10.0, 4.9.4... 4.9.0 , 结合node的版本要求就先用最近的这个4.11.0来试一下
#先卸载项目中原来的node-sass
npm uninstall node-sass
#再重装我们找出来的node-sass版本
npm install node-sass@4.11.0
安装好后,在次重新编译, OK了!
总结: 解决这类问题最重要的还是要学会查看官方文档, 然后在结合自己当前所用的开发环境这样就很容易解决了.