fex-team / fis-optimizer-png-compressor

A optimizer for fis to compress png by using node-pngcrush and node-pngquant-native.
MIT License
8 stars 6 forks source link

[ERROR] optimizer.png-compressor: _handle.Pngcrush is not a constructor #11

Open subdance opened 4 years ago

subdance commented 4 years ago

node版本v6.14.4 搜索良久无果。

shuiRong commented 3 years ago

也遇到了...坑

shuiRong commented 3 years ago

补充下细节:

首先我这边安装此插件就报错

yarn global add fis-optimizer-png-compressor                                                                                                     1 ↵ shuirong@xiaobo-iMac
yarn global v1.22.10
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error execa@3.4.0: The engine "node" is incompatible with this module. Expected version "^8.12.0 || >=9.7.0". Got "9.0.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

说有个库需要更高的node,我用 nvm 切换到 v10.23.0,安装成功。 然后执行 fis3 release prod,又报一样的错。

听上面的建议,切换到 v6.14.4,打包,成功。

真是坑,安装插件和打包项目需要的node版本不同。不过最终解决了...

oxUnd commented 3 years ago

用的时候主意看一下支持的 node 版本,由于使用了 Native 的插件, node 版本变化(主要是 v8 版本发生变化)会导致以前编译的插件不能用;