Error: Cannot find module '@electron-forge/plugin-fuses' when `npm run make` after importing manually created project
Pre-flight checklist
- [x] I have read the contribution documentation for this project.
- [X] I agree to follow the code of conduct that this project uses.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
7.3.0
Electron version
v29.0.1
Operating system
macOS 13.6.1
Last known working Electron Forge version
No response
Expected behavior
No missing required modules after import, and work normally
Actual behavior
Error: Cannot find module '@electron-forge/plugin-fuses', make failed
Steps to reproduce
- manually create project(https://www.electronjs.org/docs/latest/tutorial/tutorial-first-app)
- ...
- check
devDependenciesonly haveelectroninpackage.json - import project(https://www.electronjs.org/docs/latest/tutorial/tutorial-packaging)
- npm install --save-dev @electron-forge/cli
- npx electron-forge import
- npm run make
Additional information
package.json:
{
"name": "first-electron-app",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
- "start": "electron .",
+ "start": "electron-forge start",
- "test": "echo \"Error: no test specified\" && exit 1"
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "package": "electron-forge package",
+ "make": "electron-forge make"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
+ "@electron-forge/cli": "^7.3.0",
+ "@electron-forge/maker-deb": "^7.3.0",
+ "@electron-forge/maker-rpm": "^7.3.0",
+ "@electron-forge/maker-squirrel": "^7.3.0",
+ "@electron-forge/maker-zip": "^7.3.0",
+ "@electron-forge/plugin-auto-unpack-natives": "^7.3.0",
"electron": "^29.0.1"
+ },
+ "dependencies": {
+ "electron-squirrel-startup": "^1.0.0"
}
}
forge.config.js:
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');
module.exports = {
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
plugins: [
{
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};
I also encountered the same error.
I solved mine by additionally running the following command: devDependency seems to be missing at npx electron-forge import .
$ npm install --save-dev @electron-forge/plugin-fuses
The devDependency list is implemented in the following code, which could be added here.
https://github.com/electron/forge/blob/1aa94fc32754ffd07a3652db42952f1f22ddbd6c/packages/api/core/src/api/init-scripts/init-npm.ts#L18-L25
npm install --save-dev @electron-forge/plugin-fuses then npm run make again worked for me~
+1 on this. Came here to report this issue
+1. Faced the same problem.
After installing @electron-forge/plugin-fuses in devDependencies "npm run make" works without errors:
npm install @electron-forge/plugin-fuses --save-dev
+1 same problem, same solution
Yes, baby !
I also encountered the same error.
I solved mine by additionally running the following command:
devDependencyseems to be missing atnpx electron-forge import.$ npm install --save-dev @electron-forge/plugin-fusesThe
devDependencylist is implemented in the following code, which could be added here.https://github.com/electron/forge/blob/1aa94fc32754ffd07a3652db42952f1f22ddbd6c/packages/api/core/src/api/init-scripts/init-npm.ts#L18-L25
This worked out for me! Thx
Thanks for this solution
Thanks for the solution. Worked for me.
+1, used solutions available and it worked for me.