没有找到反应错误 bin sh build 命令的电子

electron with react error bin sh build command not found

我有一个 electron/react 应用程序,它在开发模式下运行良好,但是当涉及到构建和打包时,当我 运行 yarn electron-pack

$ build -mw
/bin/sh: build: command not found
error Command failed with exit code 127.

这发生在我安装了一些额外的包之后(之前的包工作正常) 这是我在 package.json 文件中的脚本:

"scripts": {
"start": "rescripts start",
"build": "rescripts build",
"test": "rescripts test",
"eject": "react-scripts eject",
"electron-dev": "concurrently \"BROWSER=none yarn start\" \"wait-on 
http://localhost:3000 && electron .\"",
"postinstall": "electron-builder",
"preelectron-pack": "yarn build",
"electron-pack": "build -mw"
},

这是 devDependencies

"devDependencies": {
"@rescripts/cli": "^0.0.16",
"@rescripts/rescript-env": "^0.0.14",
"concurrently": "^6.2.0",
"electron": "^13.1.8",
"electron-builder": "^22.11.7",
"typescript": "^4.3.5",
"wait-on": "^6.0.0"
}

我找到的一个临时解决方案是删除节点模块文件和 运行 npm install

rm -rf node_modules
npm install