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

Error: Cannot find module '@electron-forge/plugin-fuses' when npm run make after importing manually created project #3509

Closed
3 tasks done
Lsnsh opened this issue Feb 25, 2024 · 11 comments · Fixed by #3535
Closed
3 tasks done

Comments

@Lsnsh
Copy link

Lsnsh commented Feb 25, 2024

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

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

  1. manually create project(https://www.electronjs.org/docs/latest/tutorial/tutorial-first-app)
  2. ...
  3. check devDependencies only have electron in package.json
  4. import project(https://www.electronjs.org/docs/latest/tutorial/tutorial-packaging)
    1. npm install --save-dev @electron-forge/cli
    2. npx electron-forge import
  5. 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,
    }),
  ],
};
@rabitarochan
Copy link

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.

export const devDeps = [
siblingDep('cli'),
siblingDep('maker-squirrel'),
siblingDep('maker-zip'),
siblingDep('maker-deb'),
siblingDep('maker-rpm'),
siblingDep('plugin-auto-unpack-natives'),
];

@lingchuL
Copy link

npm install --save-dev @electron-forge/plugin-fuses then npm run make again worked for me~

@tsekiguchi
Copy link

+1 on this. Came here to report this issue

@timofey-ivashchenko
Copy link

+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

@AuWiMo
Copy link

AuWiMo commented Mar 3, 2024

+1 same problem, same solution

@Crownico
Copy link

Crownico commented Mar 4, 2024

Yes, baby !

@Luktaros
Copy link

Luktaros commented Mar 5, 2024

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.

export const devDeps = [
siblingDep('cli'),
siblingDep('maker-squirrel'),
siblingDep('maker-zip'),
siblingDep('maker-deb'),
siblingDep('maker-rpm'),
siblingDep('plugin-auto-unpack-natives'),
];

This worked out for me! Thx

@mbelasergesedi
Copy link

mbelasergesedi commented Mar 11, 2024

Thanks for this solution

@shivkumarojha
Copy link

Thanks for the solution. Worked for me.

@JustAnEric
Copy link

+1, used solutions available and it worked for me.

@zachrizzo
Copy link

Im still having this issue, when i run the command suggested above no files are added to my package.json, just the folder for electron forge

npm install --save-dev @electron-forge/plugin-fuses

I even tried switching over to yarn instead of NPM but running into other issues where if I install this dependency when it's missing, it removes other dependencies that are required when installing this one, please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.