ubuntu - 在 ubuntu 上构建 Electron 应用程序失败,错误代码为 'Permission denied'

标签 ubuntu electron building

我尝试使用“ Electron 构建器”模块在我的 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,因为我假设我的用户可能没有构建所需的权限,但导致了完全相同的错误。

以下是我的 package.json 中的脚本、依赖项和 Linux build设置:

"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 有想法或经历过类似的事情吗?

PS:如果需要更多信息,请随时询问!

最佳答案

尝试重新安装模块:

rm -rf node_modules && npm i

如果没有效果,尝试设置 Electron-builder 脚本的可执行标志:

chmod +x "$(npm bin)/Electron 构建器"

chmod +x "$(npm bin)/build" 对于旧版本的 Electron 构建器

关于ubuntu - 在 ubuntu 上构建 Electron 应用程序失败,错误代码为 'Permission denied',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53592389/

相关文章:

php - PHPMyAdmin 中的 SQL 查询面板中的自动完成不适用于 Ubuntu

android - ADT 包无法识别我在 ubuntu 上的路径

reactjs - 未使用React和Electron调用事件处理程序

reactjs - 无法在React组件中使用 Electron 的webview属性

node.js - 能够为每个BrowserWindow对象创建一个新 session ?

c++ - 使用opencv时未定义对各种函数的引用

c++ - 构建 "Monolithic"库

ruby-on-rails - Ubuntu Sqlite3 1.4.2 gem 安装错误。有任何想法吗?

javascript - 在 Electron js(Ubuntu)上锁定关闭并最小化

ios - Unity-Xcode错误: linker command failed with exit code 1 (use -v to see invocation)