在ubuntu上构建electron应用程序失败,原因是';拒绝许可';

在ubuntu上构建electron应用程序失败,原因是';拒绝许可';,ubuntu,electron,building,Ubuntu,Electron,Building,我尝试使用“electron builder”模块在我的ubuntu系统上构建我的electron项目,但是npm run dist总是输出以下错误: > project@1.0.0 dist /home/user/GitRepos/project > build sh: 1: build: Permission denied npm ERR! code ELIFECYCLE npm ERR! errno 126 npm ERR! project@1.0.0 dist: `buil

我尝试使用“electron builder”模块在我的ubuntu系统上构建我的electron项目,但是
npm run dist
总是输出以下错误:

> project@1.0.0 dist /home/user/GitRepos/project
> build

sh: 1: build: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! project@1.0.0 dist: `build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the project@1.0.0 dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2018-12-03T10_20_50_566Z-debug.log
我已经尝试使用了
sudo npm run dist
,因为我假设我的用户可能没有构建所需的权限,但却导致了完全相同的错误

以下是我的
包中的脚本、依赖项和linux构建设置。json

"scripts": {
  "start": "electron .",
  "pack": "build --dir",
  "dist": "build",
  "postinstall": "install-app-deps"
},
"dependencies": {
  "archiver": "^3.0.0",
  "electron-store": "^2.0.0",
  "popper.js": "^1.14.4",
  "unzipper": "^0.9.4"
},
"devDependencies": {
  "electron": "^3.0.10",
  "electron-builder": "^20.28.4"
},
"build": {
  "linux": {
    "target": [
      "AppImage",
      "deb"
    ]
  }
}
有人对ubuntu上的electron有过类似的想法或经历吗


附言:如果需要更多的信息,请毫不犹豫地询问

尝试重新安装模块:


rm-rf节点模块和npm i

如果无效,请尝试设置electron builder脚本的可执行标志:

chmod+x“$(npm-bin)/electron-builder”

chmod+x“$(npm-bin)/build”
对于旧版本的electron builder,您也可以尝试

rm -rf dist

显然,如果以前有任何文件,可能没有足够的权限。

首先,感谢您的回答。重新安装“有点”起作用。它实际上已经开始建造了,但现在却失败了<代码>应用程序Linux类别设置为默认“实用程序”原因=Linux.category未设置,无法从macOS文档映射=https://electron.build/configuration/configuration#LinuxBuildOptions-类别⨯ EOF和
错误:/home/user/GitRepos/project/node_modules/app builder bin/linux/x64/app builder退出,代码为1
还有其他想法吗?我已经设置了build文件夹的所有内容及其内容的可执行标志。实际上,这是下一个问题,我建议您为它创建另一个问题。但是,简单的回答是:只需根据documentation.True添加electron builder所需的package.json的所有字段。由于您的答案解决了我上面第一个问题中的具体问题,因此我将其标记为答案!编辑:你说得对,包.json中缺少了一些东西。现在它成功建造了<代码>rm-rf节点\ U模块和npm i未修复我的问题。我仍然得到126个错误。我在ubuntu 18.4上使用默认的electron示例。