Skip to content

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

@Lsnsh

Description

@Lsnsh

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,
    }),
  ],
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions