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

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

Open
5 tasks done
TheLionWithATie opened this issue Sep 7, 2024 · 10 comments
Open
5 tasks done

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

TheLionWithATie opened this issue Sep 7, 2024 · 10 comments
Labels

Comments

@TheLionWithATie
Copy link

Prerequisites

  • Using npm
  • Using an up-to-date main branch
  • Using latest version of devtools. Check the docs for how to update
  • Tried solutions mentioned in #400
  • For issue in production release, add devtools output of DEBUG_PROD=true npm run build && npm start

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

  • Node version : v20.17.0
  • electron-react-boilerplate version or branch : main (commit f6eb150)
  • Operating System and version : Windows 11 23H2
@TheLionWithATie
Copy link
Author

I solved the issue by running

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

After those commands the webapp started as normal.

@meepo-it
Copy link

meepo-it commented Sep 9, 2024

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
Copy link
Author

Try making the following changes:

  • inside webpack.config.base.ts set module: 'esnext' to module: 'NodeNext',
  • inside tsconfig.json set "module": "NodeNext" and "moduleResolution": "NodeNext",

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

@kelisiWu123
Copy link

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
Copy link

mlynch commented Sep 10, 2024

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
Copy link

mlynch commented Sep 10, 2024

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
Copy link

npm update works for me!

@viniyr
Copy link

viniyr commented Sep 11, 2024

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
Copy link

viniyr commented Sep 11, 2024

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": [],

@qtnx
Copy link

qtnx commented Oct 16, 2024

This also occurs when installing a new module. By the way, the title should be updated to:

BrowserslistError: Unknown version x.x.x of Electron

for others to reference.

Remove "browserslist": [], worked. Thanks @viniyr

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

7 participants