You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Yarn创建TypeScript版React项目遇Node版本兼容问题求助

Fixing Node Version Incompatibility for create-react-app TypeScript Project

Hey there, let's tackle this Node version issue you're facing head-on. The core problem here is your current Node version (13.5.0) doesn't meet the minimum requirement for browserslist@4.14.7—it needs Node >=13.7 or one of the specified older versions. Updating brew and Yarn alone won't fix this, but we can adjust your Node version safely without losing any existing content.

nvm is a tool that lets you switch between different Node versions seamlessly. This way, you can keep your existing projects on their current Node versions while using a compatible one for this new React app. Here's how to set it up:

  1. Install nvm via brew (since you're already using brew):

    brew install nvm
    

    After installation, add these lines to your shell configuration file (like ~/.zshrc or ~/.bashrc) to initialize nvm every time you open a terminal:

    export NVM_DIR="$HOME/.nvm"
    [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"
    [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"
    

    Restart your terminal or run source ~/.zshrc (or your respective config file) to apply the changes.

  2. Install a compatible Node version
    You can either install the minimum required version (13.7.0) or opt for a more stable LTS version like 14.x (recommended for long-term support):

    # Install Node 14 (LTS)
    nvm install 14
    
  3. Switch to the new Node version

    nvm use 14
    

    To set this as your default version for new terminals, run:

    nvm alias default 14
    
  4. Re-run the create-react-app command

    yarn create react-app mobx_course --template typescript
    

    This should now execute without the engine incompatibility error.

If you need a quick fix and don't want to upgrade Node right now, you can tell Yarn to skip engine compatibility checks. Keep in mind this might lead to unexpected issues down the line:

yarn create react-app mobx_course --template typescript --ignore-engines

Why Your Previous Updates Didn't Work

Updating brew and Yarn only refreshes those tools—your Node version stayed at 13.5.0, which is still below the >=13.7 requirement from browserslist. Using nVM ensures multiple Node versions can coexist, so you won't disrupt any existing projects that rely on older Node versions.

内容的提问来源于stack exchange,提问作者user12173449

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 07:22:54