The with-electron-typescript example has problems, it can only be created using npm and has initialization bugs and deprecated libraries #75616
Labels
invalid link
The issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened.
Verify canary release
Provide environment information
Which example does this report relate to?
with-electron-typescript
What browser are you using? (if relevant)
i am using electron
How are you deploying your application? (if relevant)
i am building a local app with electron and next.js
Describe the Bug
using yarn:
PS D:\Users\suporte.02\Downloads\Dev> yarn create next-app --example with-electron-typescript app-simple
yarn create v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- create-next-app
[##] 2/2Creating a new Next.js app in D:\Users\suporte.02\Downloads\Dev\app-simple.
Downloading files for example with-electron-typescript. This might take a moment.
Installing packages. This might take a couple of minutes.
yarn install v1.22.22
info No lockfile found.
[1/4] Resolving packages...
warning electron > @electron/get > global-agent > [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
warning electron > @electron/get > global-agent > roarr > [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
warning electron-builder > app-builder-lib > @electron/universal > @electron/asar > [email protected]: Glob versions prior to v9 are no longer supported
warning electron-builder > app-builder-lib > @electron/universal > @electron/asar > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you
want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning [email protected]: Rimraf versions prior to v4 are no longer supported
warning rimraf > [email protected]: Glob versions prior to v9 are no longer supported
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "electron-builder > [email protected]" has unmet peer dependency "[email protected]".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 18.64s.
Initialized a git repository.
Success! Created app-simple at D:\Users\suporte.02\Downloads\Dev\app-simple
Inside that directory, you can run several commands:
yarn dev
Starts the development server.
yarn build
Builds the app for production.
yarn start
Runs the built app in production mode.
We suggest that you begin by typing:
cd app-simple
yarn dev
Done in 22.98s.
PS D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app> yarn dev
yarn run v1.22.22
$ npm run build-electron && electron .
App threw an error during load
Error [ERR_REQUIRE_ESM]: require() of ES Module D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app\node_modules\electron-next\node_modules\electron-is-dev\index.js from D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app\node_modules\electron-next\index.js not supported.
Instead change the require of D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app\node_modules\electron-next\node_modules\electron-is-dev\index.js in D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app\node_modules\electron-next\index.js to a dynamic import() which is available in all CommonJS modules.
at Function._load (node:electron/js2c/node_init:2:13357)
at Object. (D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app\node_modules\electron-next\index.js:7:15)
at Function._load (node:electron/js2c/node_init:2:13357)
at Object. (D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app\main\index.js:12:41)
at Function._load (node:electron/js2c/node_init:2:13357)
at loadApplicationPackage (D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app\node_modules\electron\dist\resources\default_app.asar\main.js:121:16)
at Object. (D:\Users\suporte.02\Downloads\Dev\test-electron-yarn-app\node_modules\electron\dist\resources\default_app.asar\main.js:233:9)
at Function._load (node:electron/js2c/node_init:2:13357)
at node:electron/js2c/browser_init:2:121197
at node:electron/js2c/browser_init:2:121400
at node:electron/js2c/browser_init:2:121404
at Function._load (node:electron/js2c/node_init:2:13357)
using pnpm:
PS D:\Users\suporte.02\Downloads\Dev> pnpm create next-app --example with-electron-typescript custom-app
.../194cc951789-62ec | +1 +
.../194cc951789-62ec | Progress: resolved 1, reused 1, downloaded 0, added 1, done
Creating a new Next.js app in D:\Users\suporte.02\Downloads\Dev\custom-app.
Downloading files for example with-electron-typescript. This might take a moment.
Installing packages. This might take a couple of minutes.
WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
WARN 3 deprecated subdependencies found: [email protected], [email protected], [email protected]
Packages: +292
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 332, reused 305, downloaded 0, added 292, done
dependencies:
devDependencies:
The following dependencies have build scripts that were ignored: electron, sharp
To allow the execution of build scripts for these packages, add their names to "pnpm.onlyBuiltDependencies" in your "package.json", then run "pnpm rebuild"
Done in 8s
Initialized a git repository.
Success! Created custom-app at D:\Users\suporte.02\Downloads\Dev\custom-app
Inside that directory, you can run several commands:
pnpm run dev
Starts the development server.
pnpm run build
Builds the app for production.
pnpm start
Runs the built app in production mode.
We suggest that you begin by typing:
cd custom-app
pnpm run dev
PS D:\Users\suporte.02\Downloads\Dev> cd custom-app
D:\Users\suporte.02\Downloads\Dev\custom-app\node_modules.pnpm\[email protected]\node_modules\electron\index.js:17
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again');
^
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at getElectronPath (D:\Users\suporte.02\Downloads\Dev\custom-app\node_modules.pnpm\[email protected]\node_modules\electron\index.js:17:11)
at Object. (D:\Users\suporte.02\Downloads\Dev\custom-app\node_modules.pnpm\[email protected]\node_modules\electron\index.js:21:18)
at Module._compile (node:internal/modules/cjs/loader:1565:14)
at Object..js (node:internal/modules/cjs/loader:1708:10)
at Module.load (node:internal/modules/cjs/loader:1318:32)
at Function._load (node:internal/modules/cjs/loader:1128:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
at require (node:internal/modules/helpers:138:16)
Node.js v22.12.0
ELIFECYCLE Command failed with exit code 1.
Expected Behavior
PS D:\Users\suporte.02\Downloads\Dev\custom-app> npx create-next-app --example with-electron-typescript custom-simple-app
Creating a new Next.js app in D:\Users\suporte.02\Downloads\Dev\custom-app\custom-simple-app.
Downloading files for example with-electron-typescript. This might take a moment.
Installing packages. This might take a couple of minutes.
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
added 339 packages, and audited 340 packages in 38s
50 packages are looking for funding
run
npm fund
for detailsfound 0 vulnerabilities
Success! Created custom-simple-app at D:\Users\suporte.02\Downloads\Dev\custom-app\custom-simple-app
Inside that directory, you can run several commands:
npm run dev
Starts the development server.
npm run build
Builds the app for production.
npm start
Runs the built app in production mode.
We suggest that you begin by typing:
cd custom-simple-app
npm run dev
D:\Users\suporte.02\Downloads\Dev\custom-app> cd .\custom-simple-app
PS D:\Users\suporte.02\Downloads\Dev\custom-app\custom-simple-app> npm run dev
[0203/131712.342:ERROR:registration_protocol_win.cc(107)] CreateFile: O sistema nÒo pode encontrar o arquivo especificado. (0x2)
Ôùï Compiling / ...
Ô£ô Compiled / in 3.3s (309 modules)
GET / 200 in 3968ms
To Reproduce
I am running the commands
yarn create next-app --example with-electron-typescript
pnpm create next-app --example with-electron-typescript
And this commands generated this errors
The text was updated successfully, but these errors were encountered: