electron-react-boilerplate
electron-react-boilerplate copied to clipboard
"Cannot GET /index.html" on fresh install
Prerequisites
- [x] Using npm
- [x] Using an up-to-date
mainbranch - [x] Using latest version of devtools. Check the docs for how to update
- [x] Tried solutions mentioned in #400
- [x] 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:
Steps to Reproduce
- git clone --depth 1 --branch main https://github.com/electron-react-boilerplate/electron-react-boilerplate.git your-project-name
- cd your-project-name
- npm install
- 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 f6eb1503467e7765cf87c00ed6ab8c621323e19e)
- Operating System and version : Windows 11 23H2
I solved the issue by running
npx update-browserslist-db@latestnpm update
After those commands the webapp started as normal.
I solved the issue by running
npx update-browserslist-db@latestnpm updateAfter those commands the webapp started as normal.
it doesn‘t work
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...
I solved the issue by running
npx update-browserslist-db@latestnpm updateAfter those commands the webapp started as normal.
I successfully launched my project thanks to the answer
Getting the same issue as @CaptainJack-Git and @TheLionWithATie those changes unfortunately did not resolve it. I'm on Windows 11 in this case.
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!
npm update works for me!
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 🤔
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 installJust 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": [],
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