error react-router-dom@7.12.0: The engine "node" is incompatible with this module. Expected version ">=20.0.0". Got "18.18.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
方法一:使用 nvm (Node Version Manager) 切换 Node 版本 Windows 安装 nvm:
下载 nvm-windows:https://github.com/coreybutler/nvm-windows/releases
下载 nvm-setup.exe 并安装
安装完成后,以管理员身份打开 PowerShell 或 CMD
安装并使用 Node.js 20 版本:
bash
nvm list available
nvm install 20.18.0
nvm use 20.18.0
node --version
Yarn 设置国内镜像地址有以下几种方法:
设置 Cypress 镜像加速 bash
yarn config set cypress:https://registry.npmmirror.com/binary.html?path=cypress/ binary_mirror https://cdn.cypress.io
yarn config set cypress_download_binary_url https://npmmirror.com/mirrors/cypress/
$env:CYPRESS_INSTALL_BINARY = "https://npmmirror.com/mirrors/cypress/13.17.0/cypress.zip"
C:\Users\Administrator>yarn config set cypress_download_binary_url https://npmmirror.com/mirrors/cypress/ yarn config v1.22.22 success Set "cypress_download_binary_url" to "https://npmmirror.com/mirrors/cypress/". Done in 0.13s.
C:\Users\Administrator>