嗨,我正在使用create-react-app样板和electronic-builder开发电子反应应用程序,以打包和部署它。
但是,在CL中使用纱线运行电子生成器时,会显示此错误。
• loaded configuration file=package.json ("build" field)
• loaded parent configuration preset=react-cra
• writing effective config file=build\builder-effective-config.yaml
• packaging platform=win32 arch=x64 electron=8.0.1 appOutDir=build\win-unpacked
• default Electron icon is used reason=application icon is not set
• building target=nsis file=build\electron-react-typescript-app Setup 0.1.0.exe archs=x64 oneClick=true perMachine=false
⨯ write EPIPE stackTrace=
Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:150:25)
at writeGeneric (internal/stream_base_commons.js:141:3)
at Socket._writeGeneric (net.js:771:11)
at Socket._write (net.js:783:8)
at doWrite (_stream_writable.js:431:12)
at writeOrBuffer (_stream_writable.js:415:5)
at Socket.Writable.write (_stream_writable.js:305:11)
at Socket.Writable.end (_stream_writable.js:594:10)
at Socket.end (net.js:575:31)
at C:\Users\andrew.choi\Documents\electron-react-app\.yarn\cache\builder-util-npm-22.3.3-d8bf259145-2.zip\node_modules\builder-util\src\util.ts:193:26
at new Promise (<anonymous>)
at spawnAndWrite (C:\Users\username\Documents\electron-react-app\.yarn\cache\builder-util-npm-22.3.3-d8bf259145-2.zip\node_modules\builder-util\src\util.ts:176:10)
at NsisTarget.executeMakensis (C:\Users\username\Documents\electron-react-app\.yarn\cache\app-builder-lib-npm-22.3.3-dc71ab7fc0-2.zip\node_modules\app-builder-lib\src\targets\nsis\NsisTarget.ts:552:11)
at NsisTarget.computeScriptAndSignUninstaller (C:\Users\andrew.choi\Documents\electron-react-app\.yarn\cache\app-builder-lib-npm-22.3.3-dc71ab7fc0-2.zip\node_modules\app-builder-lib\src\targets\nsis\NsisTarget.ts:340:5)
at NsisTarget.buildInstaller (C:\Users\username\Documents\electron-react-app\.yarn\cache\app-builder-lib-npm-22.3.3-dc71ab7fc0-2.zip\node_modules\app-builder-lib\src\targets\nsis\NsisTarget.ts:278:103)
at NsisTarget.finishBuild (C:\Users\username\Documents\electron-react-app\.yarn\cache\app-builder-lib-npm-22.3.3-dc71ab7fc0-2.zip\node_modules\app-builder-lib\src\targets\nsis\NsisTarget.ts:110:7)
command not found: electron-builder
这是我的package.json文件。 如果这很重要,我正在使用Windows 10。 然后在以管理员权限打开的命令提示符中运行“ yarn dist”
{
"name": "electron-react-typescript-app",
"version": "0.1.0",
"private": true,
"main": "src/start.js",
"build": {
"appId": "123456789",
"directories": {
"buildResources": "assets",
"output": "build"
},
"win": {
"target": "nsis"
}
},
"dependencies": {
"@material-ui/core": "^4.8.0",
"@material-ui/icons": "^4.5.1",
"@reduxjs/toolkit": "^1.2.3",
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"electron-is-dev": "^1.1.0",
"electron-updater": "^4.2.0",
"express": "^4.17.1",
"immer": "^5.3.2",
"material-table": "^1.55.0",
"mssql": "^6.0.1",
"react": "^16.10.2",
"react-desktop": "^0.3.9",
"react-dom": "^16.10.2",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"tailwindcss": "^1.2.0"
},
"scripts": {
"electron": "cross-env NODE_ENV=dev nodemon --exec \"\"electron .\"\"",
"electron-build": "electron-builder",
"start": "cross-env BROWSER=none nodemon npm run react-start",
"react-start": "react-scripts start",
"build": "react-scripts build",
"react-test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"server": "node ./server/server --exec nodemon | pino-colada",
"dev": "run-p server react-start",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"proxy": "http://localhost:3500",
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"cross-env": "^6.0.3",
"devtron": "^1.4.0",
"electron": "8.0.1",
"electron-builder": "^22.3.2",
"electron-devtools-installer": "^2.2.4",
"electron-redux-devtools": "^0.3.4",
"electron-reload": "^1.5.0",
"express-pino-logger": "^4.0.0",
"node-env-run": "^3.0.2",
"nodemon": "^1.19.3",
"npm-run-all": "^4.1.5",
"pino-colada": "^1.5.1",
"redux-devtools-extension": "^2.13.8"
},
"description": "An Electron React App",
"repository": {
"type": "git",
"url": "git+https://github.com/Icecubelegacy/Electron-react-app.git"
},
"keywords": [
"electron"
],
"author": "Andrew Choi",
"license": "ISC",
"bugs": {
"url": "https://github.com/Icecubelegacy/Electron-react-app/issues"
},
"homepage": "./",
"postinstall": "electron-builder intall-app-deps"
}
答案 0 :(得分:1)
command not found: electron-builder
这可能意味着您的node_modules
文件夹在electron-builder
下没有node_modules/.bin
。
您可以尝试运行命令
yarn
这应该使您electron-builder
在本地安装,因为它已在package.json文件中的devDependencies
下列出。
答案 1 :(得分:0)
此问题现已解决。 我开始了一个新项目,将电子生成器的版本指定为22.3.5,运行纱线构建,然后运行电子包装。然后我进入.dist文件夹并安装了安装exe,然后能够成功打开.exe应用程序文件。