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

Status Code 404 Error (Cannot Resolve) When Compiling App with Electron-Builder Using Electron-Prebuilt-Compile #3764

Closed
AlmondBro opened this issue Mar 19, 2019 · 4 comments

Comments

@AlmondBro
Copy link

AlmondBro commented Mar 19, 2019

  • Electron-Builder Version: 20.38.5
  • Electron-Updater Version: 4.0.6
  • Target: Windows

Hi everyone,

When compiling my React + ElectronJS application using Electron-Builder, I get the following error when "electronVersion": "electron-prebuilt-compile" is included in the electron-builder build configuration of package.json:

cannot resolve https://github.com/electron/electron/releases/download/velectron-prebuilt-compile/electron-velectron-prebuilt-compile-win32-x64.zip: status code 404

Here is a screenshot of my output:

image

I thought initially that this was an issue with my wi-fi connection, but I am able to replicate this issue on two different computers connected to different networks, so i doubt it is an internet connectivity problem.

I initially posted this as an issue https://github.com/electron-userland/electron-prebuilt-compile/issues/78 on the electron-prebuilt-compile github; i am posting here as well as it is also related to electron-builder.

Here is my application's package.json:

{
  "name": "CVUHSD-Waypoint",
  "description": "CVUHSD WayPoint is a desktop application where teachers can quickly access functions such as submitting a helpdesk ticket, calling the helpdesk, accessing the troubleshootign tutorials, or viewing announcements.",
  "version": "0.4.4-alpha",
  "private": false,
  "main": "src/electron-starter.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/JuanDavidLopez95/CVUHSD-WayPoint.git",
    "private": false
  },
  "dependencies": {
    "cors-anywhere": "^0.4.1",
    "dotenv": "^6.2.0",
    "electron-is-dev": "^1.0.1",
    "electron-updater": "^4.0.6",
    "fullname": "^3.3.0",
    "macaddress": "^0.2.9",
    "node-notifier": "^5.4.0",
    "node-run-cmd": "^1.0.1",
    "prop-types": "^15.7.2",
    "react": "^16.8.4",
    "react-dom": "^16.8.4",
    "react-pure-lifecycle": "^3.0.0",
    "react-router": "^4.2.0",
    "react-router-dom": "^4.2.2",
    "react-scripts": "^2.1.8",
    "sendmail": "^1.4.1",
    "typescript": "^3.3.3333",
    "undefsafe": "^2.0.2",
    "windows-shortcuts": "^0.1.6"
  },
  "scripts": {
    "start": "set BROWSER=nul && react-scripts start",
    "server": "node src/server.js",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "electron": "electron .",
    "dev": "concurrently \"npm run start\" \"wait-on http://localhost:3000/ && electron .\"",
    "pack": "electron-builder --dir",
    "dist": "electron-builder",
    "build-pack": "npm run build && npm run pack",
    "build-dist": "npm run build && npm run dist",
    "electron-pack": "build --em.main=build/electron.js",
    "preelectron-pack": "npm build",
    "publish": "build --win -p always",
    "release": "build",
    "upload": "npm run build && npm run release"
  },
  "devDependencies": {
    "concurrently": "^4.1.0",
    "devtron": "^1.4.0",
    "electron": "^4.0.8",
    "electron-builder": "^20.38.5",
    "electron-prebuilt-compile": "^4.0.0",
    "electron-react-devtools": "^0.5.3",
    "eslint-plugin-react": "^7.12.4",
    "wait-on": "^3.2.0",
    "why-did-you-update": "^1.0.6"
  },
  "keywords": [],
  "author": "CVUHSD",
  "homepage": "./",
  "build": {
    "electronVersion": "electron-prebuilt-compile",
    "publish": {
      "provider": "github",
      "repo": "CVUHSD-WayPoint",
      "owner": "JuanDavidLopez95",
      "private": true,
      "releaseType": "draft",
      "publishAutoUpdate": true
    },
    "asar": true,
    "extends": null,
    "productName": "WayPoint",
    "appId": "WayPoint",
    "compression": "store",
    "copyright": "Copyright © year `${author}`",
    "extraFiles": "./build/addFFCert",
    "files": [
      "build/**/*",
      "src/*"
    ],
    "directories": {
      "buildResources": "./build"
    },
    "win": {
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64",
            "ia32"
          ]
        }
      ],
      "icon": "./build/img/wp-icon-grey-256x256.ico",
      "publisherName": "Centinela Valley Union High School District"
    },
    "nsis": {
      "oneClick": false,
      "perMachine": true,
      "allowToChangeInstallationDirectory": true,
      "installerIcon": "./build/img/wp-icon-grey.ico",
      "runAfterFinish": true,
      "menuCategory": true,
      "createDesktopShortcut": true
    }
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}
@AlmondBro AlmondBro changed the title Status Code 404 Error (Cannot Resolve) When Compiling App with Electron-Builder Status Code 404 Error (Cannot Resolve) When Compiling App with Electron-Builder Using Electron-Prebuilt-Compile Mar 19, 2019
@jacobq
Copy link
Contributor

jacobq commented Mar 19, 2019

...when "electronVersion": "electron-prebuilt-compile" is included in the electron-builder build configuration of package.json...

Ah, OK, I think that explains what you're seeing. That's not how that field is intended to be used. According to the docs:

electronVersion String - The version of electron you are packaging for. Defaults to version of electron, electron-prebuilt or electron-prebuilt-compile dependency.

So it should be a semver string (usually a 3-tuple) like "4.0.0".
I would suggest omitting it (to use the default) and then making sure electron-prebuilt-compile is in your dependencies and is pinned to the version you want to use (e.g. npm install --save electron-prebuilt-compile).

@AlmondBro
Copy link
Author

...when "electronVersion": "electron-prebuilt-compile" is included in the electron-builder build configuration of package.json...

Ah, OK, I think that explains what you're seeing. That's not how that field is intended to be used. According to the docs:

electronVersion String - The version of electron you are packaging for. Defaults to version of electron, electron-prebuilt or electron-prebuilt-compile dependency.

So it should be a semver string (usually a 3-tuple) like "4.0.0".
I would suggest omitting it (to use the default) and then making sure electron-prebuilt-compile is in your dependencies and is pinned to the version you want to use (e.g. npm install --save electron-prebuilt-compile).

I attempted to do just that, but in my compiled production build I get a javascript error pointing to the "import" keyword. This denotes that the app is not yet working with electron-prebuilt-compile in production.

What specific configuration, if any, would one use in electron-builder for working with electron-prebuilt-compile? I assume that one would not use the build folder generated by create-react-app; this would defeat the purpose of electron-prebuilt-compile. I tried to do just this (but to no success) and instead use the "public" folder where my index.html page is located -- Electron loads this index.html page. For fields such as buildResources in the electron-builder config, would I use the folder where all my React components are located?

@jacobq
Copy link
Contributor

jacobq commented Mar 19, 2019

@JuanDavidLopez95 sorry I can't offer more help. I'm not actually familiar with electron-builder, but it sounds like you're going down a logical troubleshooting path. You might want to edit the title to reflect the current problem (or open a new issue, link to it, and close this one) to make it clear where you're hitting trouble. Another thing you might try is making a minimal "dummy app" that demonstrates the problem, pushing it up to GitHub, and sharing the info with the issue as well.

@AlmondBro
Copy link
Author

AlmondBro commented Mar 20, 2019

@JuanDavidLopez95 sorry I can't offer more help. I'm not actually familiar with electron-builder, but it sounds like you're going down a logical troubleshooting path. You might want to edit the title to reflect the current problem (or open a new issue, link to it, and close this one) to make it clear where you're hitting trouble. Another thing you might try is making a minimal "dummy app" that demonstrates the problem, pushing it up to GitHub, and sharing the info with the issue as well.

Thank you @jacobq for all the help so far! I will go ahead and close this issue as its original premise has been solved. I will go open a new issue with the import keyword error in the main process

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

No branches or pull requests

2 participants