ubuntuelectronbuilding

Building electron app on ubuntu fails with 'Permission denied'


I tried building my electron project on my ubuntu system using the 'electron-builder' module, but npm run dist always outputs this error:

> [email protected] dist /home/user/GitRepos/project
> build

sh: 1: build: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] dist: `build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] 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

I already tried using sudo npm run dist, since I assumed my user might just had not the required permissions for building, but is caused the exact same error.

Here are my scripts, dependencies and linux build settings from my package.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"
    ]
  }
}

Anyone got an idea or has experienced a similar thing with electron on ubuntu?


Solution

  • Try to reinstall modules:

    rm -rf node_modules && npm i

    If it has no effect, try to set executable flag of electron-builder script:

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

    or

    chmod +x "$(npm bin)/build" for old version of electron-builder