The engine "node" is incompatible with this module

文章目录

    在运行一个从 git 仓库 clone 下来的 ant design pro 项目时,报错:

    未找到 umi

    > tyarn start:dev
    
    yarn run v1.22.10
    $ cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev
    Your node v16.14.2 is not supported by umi, please use node 10, node 12 or node 14.
    Error: Cannot find module 'umi'
    

    注意,这里的 node 版本警告可以忽略。主要问题是没有安装 umi。

    yarn install 报错

    执行

    yarn install
    

    报错:

    error commander@12.1.0: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.14.2"                                                                          error Found incompatible module.
    

    解决方法一

    > yarn config set ignore-engines true
    yarn config v1.22.10
    success Set "ignore-engines" to "true".
    Done in 0.04s.
    

    然后执行

    yarn install
    

    解决方法二

    yarn install --ignore-engines
    

    ignore-engines 即 ignore engines check

    参考

    https://stackoverflow.com/questions/45088031/how-to-ignore-incompatible-engine-node-error-on-installing-npm-dependencies-wi

    关于作者 🌱

    我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊,或者关注我的个人公众号“大象工具”, 查看更多联系方式