Skip to content

"Getting Started" instructions fail to create an electron app #3240

Closed as not planned

Description

@thehans

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

bash: node_modules/.bin/electron-forge: No such file or directory

Electron version

bash: node_modules/.bin/electron: No such file or directory

Operating system

Linux Mint 21.1

Last known working Electron Forge version

No response

Expected behavior

Quickstart instructions https://www.electronforge.io/ at the top of the page result in a working project.
For npm the command shown is: npm init electron-app@latest my-app

Actual behavior

$ npm init electron-app@latest nope
✔ Locating custom template: "base"
✔ Initializing directory
✔ Preparing template
✔ Initializing template
⚠ Installing template dependencies
  ✔ Installing production dependencies
  ✔ Installing development dependencies
  ✖ Failed to install modules: ["electron"]
    With output: Command failed with a non-zero return code (1):
    yarn add electron --dev --exact
    ➤ YN0000: ┌ Resolution step
    ➤ YN0000: └ Completed in 0s 942ms
    ➤ YN0000: ┌ Fetch step
    ➤ YN0013: │ @types/node@npm:18.16.14 can't be found in the cache and will be fetched from the remote registry
    ➤ YN0013: │ electron@npm:24.3.1 can't be found in the cache and will be fetched from the remote registry
    ➤ YN0000: └ Completed
    ➤ YN0000: ┌ Link step
    ➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
    ➤ YN0007: │ electron@npm:24.3.1 must be built because it never has been before or the last one failed
    ➤ YN0009: │ electron@npm:24.3.1 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-02665304/build.log)
    ➤ YN0000: └ Completed in 0s 277ms
    ➤ YN0000: Failed with errors in 1s 436ms
$ cat /tmp/xfs-02665304/build.log
# This file contains the result of Yarn building a package (electron@npm:24.3.1)
# Script name: postinstall

node:internal/modules/cjs/loader:1050
  throw err;
  ^

Error: Cannot find module 'extract-zip'
Require stack:
- /home/hans/projects/nope/.yarn/unplugged/electron-npm-24.3.1-ae68ae2e11/node_modules/electron/install.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
    at Module._load (node:internal/modules/cjs/loader:893:27)
    at Module.require (node:internal/modules/cjs/loader:1113:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/hans/projects/nope/.yarn/unplugged/electron-npm-24.3.1-ae68ae2e11/node_modules/electron/install.js:9:17)
    at Module._compile (node:internal/modules/cjs/loader:1226:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
    at Module.load (node:internal/modules/cjs/loader:1089:32)
    at Module._load (node:internal/modules/cjs/loader:930:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/hans/projects/nope/.yarn/unplugged/electron-npm-24.3.1-ae68ae2e11/node_modules/electron/install.js'
  ]
}

Node.js v18.14.0

Steps to reproduce

Run npm init electron-app@latest my-app as recommended from https://www.electronforge.io/ website

Additional information

No response

Activity

  1. erickzhao commented on May 23, 2023

    @erickzhao
    Member

    @thehans We currently run off of Yarn v1. See #2535 (comment) for a bit more context.

    Does using npm or Yarn v1 help your issue?

  2. added
    blocked/needs-info
    on May 23, 2023
  3. thehans commented on May 23, 2023

    @thehans
    Author

    @erickzhao I am using npm

  4. thehans commented on May 23, 2023

    @thehans
    Author

    Apparently related to #3164 though the resulting error messages differ.

  5. erickzhao commented on May 24, 2023

    @erickzhao
    Member

    Ah, I see that. That's annoying and I think you've identified the issue. Seems like Forge really wants you to use your yarn installation.

    There's an undocumented NODE_INSTALLER environment variable that you can use as a workaround for this issue. Passing in NODE_INSTALLER=npm as an env var should work for instance.

    I'll close this issue out as a duplicate of #3164 since you've properly identified the root cause!

  6. thehans commented on May 24, 2023

    @thehans
    Author

    Thanks for the tip on the environment variable, I thought I would be required to uninstall yarn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked/needs-info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions