electron-react-boilerplate / electron-react-boilerplate

A Foundation for Scalable Cross-Platform Apps
https://electron-react-boilerplate.js.org/
MIT License
23.13k stars 3.85k forks source link

"Cannot GET /index.html" on fresh install #3642

Open TheLionWithATie opened 1 week ago

TheLionWithATie commented 1 week ago

Prerequisites

Expected Behavior

After cloning the repo, installing the dependencies with "npm i" and running the application with "npm run start" the default page should have happeared in the .

Current Behavior

In the terminal I get the following error:

ERROR in ./assets/icon.svg
Module build failed (from ./node_modules/@svgr/webpack/dist/index.js):
BrowserslistError: Unknown version 31.3.0 of electron

And in the process window is displayed the text "Cannot GET /index.html", since the call to get the file fails: image

Steps to Reproduce

  1. git clone --depth 1 --branch main https://github.com/electron-react-boilerplate/electron-react-boilerplate.git your-project-name
  2. cd your-project-name
  3. npm install
  4. npm start

stacktrace:

> prestart
> cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.dev.ts

> start
> ts-node ./.erb/scripts/check-port-in-use.js && npm run prestart && npm run start:renderer

> prestart
> cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.dev.ts

> start:renderer
> cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts

Starting preload.js builder...
Starting Main Process...

> start:preload
> cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts

> start:main
> concurrently -k "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --watch --config ./.erb/configs/webpack.config.main.dev.ts" "electronmon ."

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:1212/
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.1.128:1212/
<i> [webpack-dev-server] Content not from webpack is served from 'C:\Users\dacri\Documents\Projects\your-project-name\public' directory
<i> [webpack-dev-server] 404s will fallback to '/index.html'
[1]
[1] [electronmon] waiting for a change to restart it
[1] 11:39:58.430 > Skip checkForUpdates because application is not packed and dev update config is not forced
[1] 11:39:58.433 > checkForUpdatesAndNotify called, downloadPromise is null
<i> [webpack-dev-middleware] wait until bundle finished: /index.html
ERROR in ./assets/icon.svg
Module build failed (from ./node_modules/@svgr/webpack/dist/index.js):
BrowserslistError: Unknown version 31.3.0 of electron
    at Function.select (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\browserslist\index.js:1036:15)
    at C:\Users\dacri\Documents\Projects\your-project-name\node_modules\browserslist\index.js:328:29
    at Array.reduce (<anonymous>)
    at resolve (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\browserslist\index.js:318:34)
    at Function.select (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\browserslist\index.js:1139:14)
    at C:\Users\dacri\Documents\Projects\your-project-name\node_modules\browserslist\index.js:328:29
    at Array.reduce (<anonymous>)
    at resolve (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\browserslist\index.js:318:34)
    at browserslist (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\browserslist\index.js:420:21)
    at resolveTargets (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\helper-compilation-targets\src\index.ts:168:20)
    at resolveTargetsCached (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\helper-compilation-targets\src\index.ts:181:14)
    at getTargets (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\helper-compilation-targets\src\index.ts:250:27)
    at resolveTargets (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\core\src\config\resolve-targets.ts:50:20)
    at loadPrivatePartialConfig (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\core\src\config\partial.ts:121:28)
    at loadPrivatePartialConfig.next (<anonymous>)
    at loadFullConfig (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\core\src\config\full.ts:62:49)
    at loadFullConfig.next (<anonymous>)
    at C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\core\src\transform-ast.ts:29:58
    at Generator.next (<anonymous>)
    at evaluateSync (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\gensync\index.js:251:28)
    at fn (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\gensync\index.js:89:14)
    at stopHiding - secret - don't use this - v1 (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\core\src\errors\rewrite-stack-trace.ts:99:14)
    at Object.transformFromAstSync (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@babel\core\src\transform-ast.ts:77:59)
    at jsxPlugin (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@svgr\plugin-jsx\src\index.ts:63:18)
    at run (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@svgr\core\src\transform.ts:13:16)
    at Object.transform (C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@svgr\core\src\transform.ts:24:10)
    at async C:\Users\dacri\Documents\Projects\your-project-name\node_modules\@svgr\webpack\src\index.ts:45:20
 @ ./src/renderer/App.tsx 5:0-41 8:128-132
 @ ./src/renderer/index.tsx 5:0-24 8:17-20

webpack compiled with 1 error
Not rewriting GET /index.html because the path includes a dot (.) character.
[1] [5356:0907/114000.352:ERROR:CONSOLE(1)] "Request Autofill.enable failed. {"code":-32601,"message":"'Autofill.enable' wasn't found"}", source: devtools://devtools/bundled/core/protocol_client/protocol_client.js (1)
[1] [5356:0907/114000.352:ERROR:CONSOLE(1)] "Request Autofill.setAddresses failed. {"code":-32601,"message":"'Autofill.setAddresses' wasn't found"}", source: devtools://devtools/bundled/core/protocol_client/protocol_client.js (1)
[1] [5356:0907/114000.491:ERROR:CONSOLE(2)] "Electron sandboxed_renderer.bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (2)
[1] [5356:0907/114000.491:ERROR:CONSOLE(2)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (2)

Your Environment

TheLionWithATie commented 1 week ago

I solved the issue by running

After those commands the webapp started as normal.

CaptainJack-Git commented 1 week ago

I solved the issue by running

  • npx update-browserslist-db@latest
  • npm update

After those commands the webapp started as normal.

it doesn‘t work

image
TheLionWithATie commented 6 days ago

Try making the following changes:

Honestly I changed so much stuff I'm not sure that those commands were the solution to the problem...

kelisiWu123 commented 6 days ago

I solved the issue by running

  • npx update-browserslist-db@latest
  • npm update

After those commands the webapp started as normal.

I successfully launched my project thanks to the answer

mlynch commented 6 days ago

Getting the same issue as @CaptainJack-Git and @TheLionWithATie those changes unfortunately did not resolve it. I'm on Windows 11 in this case.

mlynch commented 6 days ago

Actually @TheLionWithATie just doing npm update resolved it for me. The npx update-browserslist-db@latest seems to be unnecessary and failed for me anyways. Thanks!

fastalks commented 5 days ago

npm update works for me!

viniyr commented 5 days ago

Worked for me downgrading electron on package.json

"electron": "^25.3.0"

And then removing node_nodules, package-lock.json and then reinstalling with

npm install

Just not sure what I missing running this downgraded version 🤔

viniyr commented 5 days ago

Worked for me downgrading electron on package.json

"electron": "^25.3.0"

And then removing node_nodules, package-lock.json and then reinstalling with

npm install

Just not sure what I missing running this downgraded version 🤔

Removing the content of browserslist in package.json also worked, and it keeps the electron version.

"browserslist": [],