forge icon indicating copy to clipboard operation
forge copied to clipboard

Packaging error, file not found

Open 18626428291 opened this issue 1 year ago • 1 comments

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

6.4.2

Electron version

26.2.1

Operating system

macos 13.4

Last known working Electron Forge version

6.4.2

Expected behavior

when i used package command

"An unhandled rejection has occurred inside Forge: Error: ENOENT: no such file or directory, stat '/private/var/folders/nl/bg8c1j554f992v80ccqbz57c0000gn/T/electron-packager/darwin-x64/first-app-darwin-x64-yb3210/Electron.app/Contents/Resources/app/node_modules/electron-squirrel-startup'"

my mac is m1 chip

project is electron-forge default demo

Actual behavior

I encountered an error when packaging according to the instructions in the document

Steps to reproduce

I encountered an error when packaging according to the instructions in the document

{
    "name": "first-app",
    "productName": "first-app",
    "version": "1.0.0",
    "description": "My Electron application description",
    "main": ".vite/build/main.js",
    "scripts": {
        "start": "electron-forge start",
        "package": "electron-forge package",
        "make": "electron-forge make",
        "publish": "electron-forge publish",
        "lint": "eslint --ext .ts,.tsx ."
    },
    "keywords": [],
    "author": {
        "name": "xujiajun",
        "email": "[email protected]"
    },
    "license": "MIT",
    "devDependencies": {
        "@electron-forge/cli": "^6.4.2",
        "@electron-forge/maker-deb": "^6.4.2",
        "@electron-forge/maker-dmg": "^6.4.2",
        "@electron-forge/maker-rpm": "^6.4.2",
        "@electron-forge/maker-squirrel": "^6.4.2",
        "@electron-forge/maker-zip": "^6.4.2",
        "@electron-forge/plugin-auto-unpack-natives": "^6.4.2",
        "@electron-forge/plugin-vite": "^6.4.2",
        "@typescript-eslint/eslint-plugin": "^5.62.0",
        "@typescript-eslint/parser": "^5.62.0",
        "electron": "26.2.1",
        "eslint": "^8.49.0",
        "eslint-plugin-import": "^2.28.1",
        "ts-node": "^10.9.1",
        "typescript": "~4.5.4"
    },
    "dependencies": {
        "electron-squirrel-startup": "^1.0.0"
    }
}

force.config.ts
import type { ForgeConfig } from '@electron-forge/shared-types'
import { MakerSquirrel } from '@electron-forge/maker-squirrel'
import { MakerZIP } from '@electron-forge/maker-zip'
import { MakerDMG } from '@electron-forge/maker-dmg'
import { MakerDeb } from '@electron-forge/maker-deb'
import { MakerRpm } from '@electron-forge/maker-rpm'
import { VitePlugin } from '@electron-forge/plugin-vite'

const config: ForgeConfig = {
    packagerConfig: {},
    rebuildConfig: {},
    makers: [
        // new MakerSquirrel({}),
        new MakerZIP({}, ['darwin']),
        new MakerRpm({}),
        new MakerDMG({}),
        new MakerDeb({}),
    ],
    plugins: [
        new VitePlugin({
            // `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
            // If you are familiar with Vite configuration, it will look really familiar.
            build: [
                {
                    // `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
                    entry: 'src/main.ts',
                    config: 'vite.main.config.ts',
                },
                {
                    entry: 'src/preload.ts',
                    config: 'vite.preload.config.ts',
                },
            ],
            renderer: [
                {
                    name: 'main_window',
                    config: 'vite.renderer.config.ts',
                },
            ],
        }),
    ],
}

export default config

Additional information

No response

18626428291 avatar Sep 13 '23 06:09 18626428291