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

使用Yarn运行npm脚本时遭遇ERR spawn EINVAL错误求助

运行包含Yarn的npm脚本时出现"ERR spawn EINVAL"错误

问题重现步骤

  • 使用create-react-app初始化项目
  • 在package.json中添加如下脚本:
"scripts": {
    "lint": "yarn add -D prettier && yarn add -D babel-eslint && npx install-peerdeps --dev eslint-config-airbnb && yarn add -D eslint-config-prettier eslint-plugin-prettier"
}
  • 执行npm run lint,系统询问是否使用Yarn,输入"y"确认
  • 随后抛出错误:ERR spawn EINVAL

已尝试的解决方法

  • 全局安装Yarn:npm install -g yarn
  • 检查配置与环境变量,未发现异常

环境信息

  • 操作系统:Windows 11
  • Node版本:
> node --version  
v20.12.2
  • npm版本:
> npm --v
10.5.0
  • Yarn版本:
> yarn --v
yarn install v1.22.22

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 17:27:31