ionic 开发之爬坑:Error: Node Sass does not yet support your current environment:

ps:补充

ionic项目自然也是用webpack管理的项目,webpack通过配置可以将ts编译成js,将sass、scss编译成css等。
node-sass是解析sass和scss=>css的基础,webpack中的sass-loader依赖于node-sass,所有想要打包sass和scss文件,这个依赖是避免不了的。

ionic 开发过程中node版本升级后,ionic cordova run ios -lc命令调试项目时报错:

Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (64)
For more information on which environments are supported please see:

QQ20180731-165922.png

错误提示的其实很明显了,当前版本node-sass 不支持当前环境,即node-sass版本较低而node版本较高(也可以根据提示路径找到当前node-sass进行查看版本号)。

解决方案:
一般我们不会再将node版本回退,而是升级node-sass(升级过程中确保网络正常)。

update你的sass版本即可:

npm rebuild node-sass
或者自己手动升级:

1.先卸载

npm uninstall --save node-sass

2.清除缓存

npm cache clean -f

3.升级node-sass模块

npm install --save node-sass
也可以卸载、安装指定版本的node-sass:

安装指定版本node-sass模块

npm install --save node-sass@4.9.2

卸载指定版本node-sass模块

npm uninstall --save node-sass@4.9.2

以上问题的解决方法希望对读者有所帮助,有更好的解决方案欢迎大家跟我交流~~~

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容