Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest electron-builder fails on Travis with macOS #4134

Open
sindresorhus opened this issue Aug 8, 2019 · 31 comments
Open

Latest electron-builder fails on Travis with macOS #4134

sindresorhus opened this issue Aug 8, 2019 · 31 comments
Labels

Comments

@sindresorhus
Copy link

  • Version: 21.2.0
  • Target: macOS, Linux, Windows

electron-builder fails on Travis:

⨯ /Users/travis/build/sindresorhus/caprine/node_modules/app-builder-bin/mac/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  stackTrace=
Error: /Users/travis/build/sindresorhus/caprine/node_modules/app-builder-bin/mac/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
  at ChildProcess.<anonymous> (/Users/travis/build/sindresorhus/caprine/node_modules/builder-util/src/util.ts:239:14)
  at Object.onceWrapper (events.js:291:20)
  at ChildProcess.emit (events.js:203:13)
  at maybeClose (internal/child_process.js:1021:16)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

See: https://travis-ci.org/sindresorhus/caprine/builds/569315545


macOS 10.14

$ node --version
v12.8.0
$ npm --version
6.10.2
$ nvm --version
0.34.0

@hacdias
Copy link

hacdias commented Aug 14, 2019

Exactly the same happening on Linux Travis:

⨯ /home/travis/build/ipfs-shipyard/ipfs-desktop/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  stackTrace=
Error: /home/travis/build/ipfs-shipyard/ipfs-desktop/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
at ChildProcess.<anonymous> (/home/travis/build/ipfs-shipyard/ipfs-desktop/node_modules/builder-util/src/util.ts:239:14)
at Object.onceWrapper (events.js:284:20)
at ChildProcess.emit (events.js:196:13)
at maybeClose (internal/child_process.js:1000:16)

@hacdias
Copy link

hacdias commented Aug 16, 2019

/cc @develar

@alibosworth
Copy link

@sindresorhus did you resolve this? Your builds seem to be passing now: https://travis-ci.org/sindresorhus/caprine/builds

Your snippet didn't include it but are you 100% that the linux build overwriting message was just a warning and not a factor on the failure?

  ⨯ /Users/travis/build/sindresorhus/caprine/node_modules/app-builder-bin/mac/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  stackTrace=
                                                                                                                                                  Error: /Users/travis/build/sindresorhus/caprine/node_modules/app-builder-bin/mac/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
                                                                                                                                                      at ChildProcess.<anonymous> (/Users/travis/build/sindresorhus/caprine/node_modules/builder-util/src/util.ts:239:14)
                                                                                                                                                      at Object.onceWrapper (events.js:291:20)
                                                                                                                                                      at ChildProcess.emit (events.js:203:13)
                                                                                                                                                      at maybeClose (internal/child_process.js:1021:16)
                                                                                                                                                      at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
  • overwrite published file  file=caprine_2.35.0_amd64.deb reason=already exists on GitHub
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dist: `tsc && electron-builder --macos --linux --windows`
npm ERR! Exit status 1

@CvX
Copy link

CvX commented Aug 20, 2019

@alibosworth The issue is still present (it affects only the builds that are publishing build artifacts to GitHub), and the overwriting warning is unrelated. Here's a newer log, without these warnings:

https://travis-ci.org/sindresorhus/caprine/builds/574252506

@hacdias
Copy link

hacdias commented Sep 3, 2019

So the problem is solved for me: there was another, different, error buried deeper in the logs which was the true cause of failure. 21.0.15 added the feature to add to snapstore by default and that should have been a breaking change.

azu added a commit to azu/mu-epub-reader that referenced this issue Sep 15, 2019
@mx2323
Copy link

mx2323 commented Oct 16, 2019

to anyone with this issue - i was able to get around this by getting the snap upload to work.

you need to install snapCraft, then login, then do a snapcraft register, then it should work.

@mifi
Copy link
Contributor

mifi commented Nov 5, 2019

I added -c.snap.publish=github to the command line (see https://www.electron.build/configuration/publish). This causes it to still build snap but only publish it to github, so don't need to register for snapcraft.

@stale
Copy link

stale bot commented Jan 4, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Jan 4, 2020
@sindresorhus
Copy link
Author

Please keep this open.

@stale stale bot removed the backlog label Jan 4, 2020
@SterlingChin
Copy link

I'm currently having this same issue and haven't been able to resolve it.

  • Version: 22.3.2
⨯ /Users/<user>/personal/<repo>/node_modules/app-builder-bin/mac/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  stackTrace=
Error: /Users/<user>/personal/<repo>/node_modules/app-builder-bin/mac/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
    at ChildProcess.<anonymous> (/Users/<user>/personal/<repo>/node_modules/app-builder-lib/node_modules/builder-util/src/util.ts:239:14)
    at Object.onceWrapper (events.js:313:26)
    at ChildProcess.emit (events.js:223:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

Here is my package.json:

  "name": "name",
  "version": "0.1.0",
  "author": "me",
  "description": "random application",
  "private": true,
  "main": "public/electron.js",
  "homepage": "./",
  "build": {
    "appId": "com.example.electron-cra",
    "files": [
      "build/**/*",
      "node_modules/**/*"
    ],
    "directories": {
      "buildResources": "assets"
    }
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test.js --env=jsdom",
    "pack": "electron-builder --dir",
    "electron-build": "electron-builder",
    "build-electron": "yarn build && yarn electron-build -c.snap.publish=github",
    "start-electron": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\""
  },
  "dependencies": {
    "@emotion/core": "^10.0.22",
    "@emotion/styled": "^10.0.23",
    "autoprefixer": "7.1.6",
    "babel-core": "6.26.0",
    "babel-eslint": "10.0.3",
    "babel-jest": "^24.9.0",
    "babel-loader": "8.0.6",
    "babel-preset-react-app": "^3.1.2",
    "babel-runtime": "6.26.0",
    "case-sensitive-paths-webpack-plugin": "2.1.1",
    "chalk": "1.1.3",
    "connected-react-router": "^4.5.0",
    "cross-env": "^7.0.0",
    "css-loader": "0.28.7",
    "deep-get-set": "^1.1.0",
    "dotenv": "4.0.0",
    "dotenv-expand": "4.2.0",
    "electron-is-dev": "^1.1.0",
    "eslint": "^6.6.0",
    "eslint-config-react-app": "^2.1.0",
    "eslint-loader": "1.9.0",
    "eslint-plugin-flowtype": "2.39.1",
    "eslint-plugin-import": "2.8.0",
    "eslint-plugin-jsx-a11y": "5.1.1",
    "eslint-plugin-react": "7.4.0",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "1.1.5",
    "firebase": "^6.4.0",
    "fs-extra": "3.0.1",
    "history": "^4.7.2",
    "html-webpack-plugin": "2.29.0",
    "jest": "24.9.0",
    "moment": "^2.22.2",
    "object-assign": "4.1.1",
    "postcss-flexbugs-fixes": "3.2.0",
    "postcss-loader": "2.0.8",
    "promise": "8.0.1",
    "raf": "3.4.0",
    "react": "^16.5.2",
    "react-dev-utils": "^5.0.2",
    "react-dom": "^16.5.2",
    "react-redux": "^5.0.7",
    "react-router-dom": "^4.3.1",
    "redux": "^4.0.0",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0",
    "resolve": "1.6.0",
    "style-loader": "0.19.0",
    "sw-precache-webpack-plugin": "0.11.4",
    "url-loader": "0.6.2",
    "webpack": "4.41.5",
    "webpack-dev-server": "3.10.2",
    "webpack-manifest-plugin": "1.3.2",
    "whatwg-fetch": "2.0.3"
  },
  "jest": {
    "collectCoverageFrom": [
      "src/**/*.{js,jsx,mjs}"
    ],
    "setupFiles": [
      "<rootDir>/config/polyfills.js"
    ],
    "testMatch": [
      "<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
      "<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
    ],
    "testEnvironment": "node",
    "testURL": "http://localhost",
    "transform": {
      "^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
      "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
      "^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
    },
    "transformIgnorePatterns": [
      "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
    ],
    "moduleNameMapper": {
      "^react-native$": "react-native-web"
    },
    "moduleFileExtensions": [
      "web.js",
      "js",
      "json",
      "web.jsx",
      "jsx",
      "node",
      "mjs"
    ]
  },
  "babel": {
    "presets": [
      "react-app"
    ]
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "devDependencies": {
    "concurrently": "^5.1.0",
    "electron": "^8.0.1",
    "electron-builder": "^22.3.2",
    "react-scripts": "^3.4.0",
    "wait-on": "^4.0.0"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

And my electron.js file:

const path = require('path');
const isDev = require('electron-is-dev')

const {app, BrowserWindow, Menu } = electron;

let mainWindow

app.on('ready', () => {
    mainWindow = new BrowserWindow({
        height: 900,
        width: 1500,
        center: true,
        webPreferences: {
            nodeIntegration: true
        }
    });

    mainWindow.loadURL(
        isDev
            ? "http://localhost:3000"
            : `file://${path.join(__dirname, "../build/index.html")}`
        );

    mainWindow.on('closed', () => {
        app.quit();
    });

    const mainMenu = Menu.buildFromTemplate(mainMenuTemplate())

    Menu.setApplicationMenu(mainMenu)
})

const mainMenuTemplate = () => {

    const isIOS = process.platform === 'darwin' // darwin is iOS

    let menuItems = [
        {
            label: 'File',
            submenu:[
                {
                    label: 'Quit',
                    accelerator: isIOS ? 'Command+Q' : 'Ctrl+Q',
                    click() {
                        app.quit()
                    }
                }
            ]
        },
        {
            label: 'Edit',
            submenu: [
                {
                    role: 'copy',
                    accelerator: isIOS ? 'Command+C' : 'Ctrl+C',
                },
                {
                    role: 'paste',
                    accelerator: isIOS ? 'Command+V' : 'Ctrl+V',
                },
                {
                    role: 'undo',
                    accelerator: isIOS ? 'Command+Z' : 'Ctrl+Z',
                },
            ]
        }
    ];

    isIOS && menuItems.unshift({label: ''}); // Adds an object for iOS so that we can have a "file"

    isDev && menuItems.push({ // This allows for dev tools
        label: 'Developer Tools',
        submenu: [
            {
                label:'Toggle DevTools',
                accelerator: process.platform === 'darwin' ? 'Command+I' : 'Ctrl+I',
                click(item, focusedWindow){
                    focusedWindow.toggleDevTools();
                }
            },
            {
                role: 'reload'
            }
        ]
    })
    return menuItems
}

@SterlingChin
Copy link

So, after a lot of trial and error, I've got a work around. I ended up lowering version number for electron to 6.0.11. I don't think this is the solution, but this has got the application bundling and shipping code. I'd love a more permanent solution, and I'm happy to help in any way I can.

@stale
Copy link

stale bot commented Apr 19, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Apr 19, 2020
@sindresorhus
Copy link
Author

Please keep this open.

@stale stale bot removed the backlog label Apr 20, 2020
@marckohlbrugge
Copy link

It seems like the problem is related to the snapcraft provider. It's a default provider for linux builds, so you'll need to set your own through package.json. For example:

"linux": {
  "publish": ["github"]
}

That overrides the default which includes snapcraft. You could probably use an empty array ([]) as well.

hovancik added a commit to hovancik/stretchly that referenced this issue Jul 4, 2020
@hovancik
Copy link

hovancik commented Jul 4, 2020

For me, adding following does not help:

"linux": {
  "publish": ["github"]
}

The same with adding -c.snap.publish=github

Also tried following without success.

    "snap": {
      "publish": "github"
    },

Also tried installing snapd and snapcraft but no change ;/

node: 12.14.1
electron: 9.0.5
builder: 22.7.0

error:

  ⨯ /home/travis/build/hovancik/stretchly/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  stackTrace=
Error: /home/travis/build/hovancik/stretchly/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
at ChildProcess.<anonymous> (/home/travis/build/hovancik/stretchly/node_modules/builder-util/src/util.ts:243:14)
at Object.onceWrapper (events.js:313:26)
at ChildProcess.emit (events.js:223:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

Removing snap from targets helps finishing successfully ;/

hovancik added a commit to hovancik/stretchly that referenced this issue Jul 9, 2020
* Contributor release 0.99.5

* Try fixing error, but didn't work ;/ 

electron-userland/electron-builder#4134 (comment)
@stale
Copy link

stale bot commented Sep 2, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Sep 2, 2020
@sindresorhus
Copy link
Author

Please keep this open.

@stale stale bot removed the backlog label Sep 2, 2020
@nukeop
Copy link

nukeop commented Oct 11, 2020

I have the same issue: https://github.com/nukeop/nuclear/runs/1238455218

Interestingly, I have a different job that does almost exactly the same thing, but doesn't run tests, doesn't cache dependencies, and uploads artifacts. This one passes: https://github.com/nukeop/nuclear/runs/1238509178

@alectrocute
Copy link

Still an issue, FYI :)

@stale
Copy link

stale bot commented Feb 2, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Feb 2, 2021
@hovancik
Copy link

hovancik commented Feb 2, 2021

For me yes, still need to use some workarounds.

@hovancik
Copy link

hovancik commented Feb 2, 2021

Bot bot

@stale stale bot removed the backlog label Feb 2, 2021
@stale
Copy link

stale bot commented Jun 7, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Jun 7, 2021
@sindresorhus
Copy link
Author

Please keep this open.

@stale stale bot removed the backlog label Jun 7, 2021
@develar develar added the mac label Jun 7, 2021
@stale
Copy link

stale bot commented Aug 28, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Aug 28, 2021
@sindresorhus
Copy link
Author

Please keep this open.

@stale stale bot removed the backlog label Aug 28, 2021
@chiuwingyan
Copy link

This problem still exists, how can I solve it?

@nukeop
Copy link

nukeop commented Dec 16, 2021

I just moved to github actions, Travis has deteriorated in quality of service.

@stale
Copy link

stale bot commented Apr 16, 2022

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Apr 16, 2022
@sindresorhus
Copy link
Author

Please keep this open.

@stale stale bot removed the backlog label Apr 17, 2022
@divefox
Copy link

divefox commented Nov 20, 2023

Please keep this open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests