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

The with-electron-typescript example has problems, it can only be created using npm and has initialization bugs and deprecated libraries #75616

Closed
1 task done
PabloGLeiteDeSouza opened this issue Feb 3, 2025 · 1 comment
Labels
invalid link The issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened.

Comments

@PabloGLeiteDeSouza
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 8005
  Available CPU cores: 8
Binaries:
  Node: 22.12.0
  npm: 11.0.0
  Yarn: 1.22.22
  pnpm: 10.0.0
Relevant Packages:
  next: 15.1.6 // Latest available version is detected (15.1.6).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 4.9.5
Next.js Config:
  output: export
Done in 3.21s

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 .

build-electron
tsc -p electron-src

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:

  • electron-is-dev 1.2.0 (3.0.1 is available)
  • electron-next 3.1.5
  • react 18.3.1 (19.0.0 is available)
  • react-dom 18.3.1 (19.0.0 is available)

devDependencies:

  • @types/node 14.18.63 (22.13.0 is available)
  • @types/react 16.14.62 (19.0.8 is available)
  • @types/react-dom 16.9.25 (19.0.3 is available)
  • electron 27.3.11 (34.0.2 is available)
  • electron-builder 24.13.3 (25.1.8 is available)
  • next 15.1.6
  • rimraf 3.0.2 (6.0.1 is available) deprecated
  • typescript 4.9.5 (5.7.3 is available)

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

pnpm run dev

@ dev D:\Users\suporte.02\Downloads\Dev\custom-app
npm run build-electron && electron .

build-electron
tsc -p electron-src

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 details

found 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

dev
npm run build-electron && electron .

build-electron
tsc -p electron-src

[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

@github-actions github-actions bot closed this as completed Feb 3, 2025
Copy link
Contributor

github-actions bot commented Feb 3, 2025

We could not detect a valid reproduction link. Make sure to follow the bug report template carefully.

Why was this issue closed?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We need a link to a public GitHub repository (template for App Router, template for Pages Router), but you can also use these templates: CodeSandbox: App Router or CodeSandbox: Pages Router.

The bug template that you filled out has a section called "Link to the code that reproduces this issue", which is where you should provide the link to the reproduction.

  • If you did not provide a link or the link you provided is not valid, we will close the issue.
  • If you provide a link to a private repository, we will close the issue.
  • If you provide a link to a repository but not in the correct section, we will close the issue.

What should I do?

Depending on the reason the issue was closed, you can do the following:

  • If you did not provide a link, please open a new issue with a link to a reproduction.
  • If you provided a link to a private repository, please open a new issue with a link to a public repository.
  • If you provided a link to a repository but not in the correct section, please open a new issue with a link to a reproduction in the correct section.

In general, assume that we should not go through a lengthy onboarding process at your company code only to be able to verify an issue.

My repository is private and cannot make it public

In most cases, a private repo will not be a sufficient minimal reproduction, as this codebase might contain a lot of unrelated parts that would make our investigation take longer. Please do not make it public. Instead, create a new repository using the templates above, adding the relevant code to reproduce the issue. Common things to look out for:

  • Remove any code that is not related to the issue. (pages, API routes, components, etc.)
  • Remove any dependencies that are not related to the issue.
  • Remove any third-party service that would require us to sign up for an account to reproduce the issue.
  • Remove any environment variables that are not related to the issue.
  • Remove private packages that we do not have access to.
  • If the issue is not related to a monorepo specifically, try to reproduce the issue without a complex monorepo setup

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps by opening a new issue.

I think my reproduction is good enough, why aren't you looking into it quickly?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

@github-actions github-actions bot added the invalid link The issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened. label Feb 3, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid link The issue was auto-closed due to a missing/invalid reproduction link. A new issue should be opened.
Projects
None yet
Development

No branches or pull requests

1 participant