electron / electron/forge

`npx create-electron-app` fails on npm v12

Open
#4,353 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.

### Forge version

7.11.2

### Electron version

44.0.0

### Operating system

macOS 26.6.2

### Last known working Forge version

_No response_

### Expected behavior

`npx create-electron-app` succeeds.

### Actual behavior

`npx create-electron-app` fails.

```
% npx create-electron-app .
npm notice run npx
npm notice run 'create-electron-app' .

✔ Resolving package manager: npm v12.0.2
✔ Resolving template: vite-typescript
› Using @electron-forge/template-vite-typescript (local module)
✔ Resolving Electron version: latest
› Using Electron version tag: latest
✔ Initializing directory
✔ Initializing git repository
✔ Preparing template
✔ Initializing template
⚠ Installing template dependencies
✔ Installing production dependencies
✖ Failed to install modules: ["@electron-forge/plugin-vite@^7.11.2","@types/electron-squirrel-startup@^1.0.2","@typescript-eslint/eslint-plugin@^5.0.0","@typescript-eslint/parser@^5.0.0","eslint@^8.0.1","esl
int-plugin-import@^2.25.0","typescript@~4.5.4","vite@^5.0.12"]
With output: Command failed with a non-zero return code (1):
npm install @electron-forge/plugin-vite@^7.11.2 @types/electron-squirrel-startup@^1.0.2 @typescript-eslint/eslint-plugin@^5.0.0 @typescript-eslint/parser@^5.0.0 eslint@^8.0.1 eslint-plugin-import@^2.25.0
typescript@~4.5.4 vite@^5.0.12 --save-dev
npm error code EALLOWGIT
npm error Fetching packages of type "git" have been disabled
npm error Refusing to fetch "@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2"
npm error A complete log of this run can be found in: /Users/nikwen/.npm/_logs/2026-08-27T12_03_07_388Z-debug-0.log
npm error code EALLOWGIT
npm error Fetching packages of type "git" have been disabled
npm error Refusing to fetch "@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2"
npm error A complete log of this run can be found in: /Users/nikwen/.npm/_logs/2026-08-27T12_03_07_388Z-debug-0.log
⚠ Finalizing dependencies
✖ Failed to install modules: ["@electron/fuses@^1.0.0","@electron-forge/cli@^7.11.2","@electron-forge/maker-squirrel@^7.11.2","@electron-forge/maker-zip@^7.11.2","@electron-forge/maker-deb@^7.11.2","@elect
ron-forge/maker-rpm@^7.11.2","@electron-forge/plugin-auto-unpack-natives@^7.11.2","@electron-forge/plugin-fuses@^7.11.2"]
With output: Command failed with a non-zero return code (1):
npm install @electron/fuses@^1.0.0 @electron-forge/cli@^7.11.2 @electron-forge/maker-squirrel@^7.11.2 @electron-forge/maker-zip@^7.11.2 @electron-forge/maker-deb@^7.11.2 @electron-forge/maker-rpm@^7.11.2
@electron-forge/plugin-auto-unpack-natives@^7.11.2 @electron-forge/plugin-fuses@^7.11.2 --save-dev
npm error code EALLOWGIT
npm error Fetching packages of type "git" have been disabled
npm error Refusing to fetch "@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2"
npm error A complete log of this run can be found in: /Users/nikwen/.npm/_logs/2026-08-27T12_03_18_810Z-debug-0.log
npm error code EALLOWGIT
npm error Fetching packages of type "git" have been disabled
npm error Refusing to fetch "@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2"
npm error A complete log of this run can be found in: /Users/nikwen/.npm/_logs/2026-08-27T12_03_18_810Z-debug-0.log
```

npm v12 disables fetching Git dependencies by default. (It also disables postinstall scripts, which causes issues with some of the dependencies that get installed.)

### Steps to reproduce

1. Upgrade npm to v12
2. `npx create-electron-app my-app`

### Additional information

Can be worked around with the following `.npmrc`:

```
allow-git=all
```

It'll also cause issues with postinstall scripts that don't run:

```
% npm install

up to date, audited 707 packages in 772ms

32 vulnerabilities (3 low, 1 moderate, 27 high, 1 critical)

To address all issues (including breaking changes), run:
npm audit fix --force

Run `npm audit` for details.
npm warn install-scripts 3 packages had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts electron-winstaller@5.4.4 (install: node ./script/select-7z-arch.js)
npm warn install-scripts esbuild@0.21.5 (postinstall: node install.js)
npm warn install-scripts fsevents@2.3.3 (install: (install scripts present))
npm warn install-scripts
npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve ` to allow.
```

As a result, the default packaging scripts won't work. We might want to list those packages as approved in the template `package.json` files.

Contributor guide

Open the contributing guide

Research direction

The failure occurs in npx create-electron-app when npm v12 installs the generated template. Start by reproducing the command with npm v12 and inspecting the template package.json files, especially their dependency and script settings. Done means a generated app installs without the manual .npmrc workaround and its default packaging scripts work.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, node.js, typescript
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
54/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.