Electron Forge问题:“无法为Linux生成目标DEB”

huangapple go评论71阅读模式
英文:

Electron Forge issue: "cannot make for linux and target deb"

问题

我再次遇到了问题,但无法解决...

问题

我有一个Electron应用程序,想要为Linux构建它。到目前为止,我已经成功创建了一个Windows(Squirrel)构建版本,但当我从虚拟机执行相同的命令时,出现以下错误:
cannot make for linux and target deb: the maker declared that it cannot run on linux

Forge配置

module.exports = {
  packagerConfig: {
    asar: true,
    linux: {
      target: 'deb',
    }
  },
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        authors: 'Sample author',
        description: 'Some description'
      },
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {
        authors: 'Sample author',
        description: 'Some description',
        "name": "app",
        "category": "Games"
      },
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
  plugins: [
    {
      name: '@electron-forge/plugin-auto-unpack-natives',
      config: {},
    },
  ],
};

我原本期望收到一个好的.deb文件,但我却得到了这个错误...

英文:

I'm once again facing an issue and I can't get out of it...

The problem

I have an Electron app and I want to build it for linux. So far, I've succeed to create a Windows (Squirrel) build for it, but when I execute the same command from a virtual machine, it gives this error:
cannot make for linux and target deb: the maker declared that it cannot run on linux

Forge configuration

module.exports = {
  packagerConfig: {
    asar: true,
    linux: {
      target: 'deb',
    }
  },
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        authors: 'Sample author',
        description: 'Some description'
      },
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {
        authors: 'Sample author',
        description: 'Some description',
        "name": "app",
        "category": "Games"
      },
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
  plugins: [
    {
      name: '@electron-forge/plugin-auto-unpack-natives',
      config: {},
    },
  ],
};

I was expecting to receive a nice .deb file, but I got that error...

答案1

得分: 2

我已解决!

解决方案

作者和描述设置必须放在引号中,如下所示:

"authors":"test",
"description":"some desc"

完整配置

module.exports = {
packagerConfig: {
    asar: true,
    linux: {
      target: 'deb',
    }
  },
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        authors: 'Sample author',
        description: 'Some description'
      },
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {
        "authors": 'Sample author',
        "description": 'Some description',
        "name": "app",
        "category": "Games"
      },
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
  plugins: [
    {
      name: '@electron-forge/plugin-auto-unpack-natives',
      config: {},
    },
  ],
};
英文:

I resolved!

Solution

authors and description setting has to be under quotes, like so:

"authors":"test",
"description":"some desc"

Full configuration

module.exports = {
packagerConfig: {
    asar: true,
    linux: {
      target: 'deb',
    }
  },
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        authors: 'Sample author',
        description: 'Some description'
      },
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {
        "authors": 'Sample author',
        "description": 'Some description',
        "name": "app",
        "category": "Games"
      },
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
  plugins: [
    {
      name: '@electron-forge/plugin-auto-unpack-natives',
      config: {},
    },
  ],
};

huangapple
  • 本文由 发表于 2023年7月10日 22:50:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76654923.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定