electron 电子生成器错误:找不到模块'dmg-license'

slwdgvem  于 2022-12-08  发布在  Electron
关注(0)|答案(1)|浏览(1046)

我正在寻找一个简单的方法来建立一个电子应用程序的macOS,从linux机器。
不幸的是,electron-builder -m命令不起作用,下面是该命令的完整输出:

electron-builder -m              
  • electron-builder  version=22.14.13 os=5.11.0-49-generic
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
⨯ Cannot find module 'dmg-license'
Require stack:
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/node_modules/dmg-builder/out/dmgLicense.js
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/node_modules/dmg-builder/out/dmg.js
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/node_modules/dmg-builder/out/dmgUtil.js
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/node_modules/app-builder-lib/out/macPackager.js
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/node_modules/app-builder-lib/out/packager.js
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/node_modules/app-builder-lib/out/index.js
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/out/builder.js
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/out/cli/cli.js
- /home/myUser/.nvm/versions/node/v16.13.0/lib/node_modules/electron-builder/cli.js  failedTask=build stackTrace=Error: Cannot find module 'dmg-license'

我已经尝试安装依赖项,但它只能安装在macOS上...
我也尝试过安装不同的版本,包括20.37.*22.11.7@latest22.14.13)和@next

是否有其他方法可以为macOS构建应用程序(我使用的程序是用于私人用途的,因此如果需要额外的用户步骤来安装,也没关系)?
或者有什么方法可以解决此依赖性问题?

agyaoht7

agyaoht71#

试试看:

npm i dmg-license

也许这是构建. https://www.electronforge.io/的另一种方法
编辑:
我也遇到过类似的错误,但我的问题是我创建了子目录,而默认的package.json只包括构建中的顶级目录。

"build": {
    "appId": "com.example.capacitor-app",
    "productName": "Capacitor App",
    "files": [
      "assets/*",
      "build/*",
      "preloader.js",
      "plugins/*",
      "capacitor.config.json",
      "app/**"
    ],

结束日期

"build": {
    "appId": "com.example.capacitor-app",
    "productName": "Capacitor App",
    "files": [
      "assets/**",
      "build/**",
      "preloader.js",
      "plugins/**",
      "capacitor.config.json",
      "app/**"
    ],

请注意,另一个人出现了cannot find module错误,因为他使用www而不是app作为角代码目录:https://github.com/electron-userland/electron-builder/issues/303

相关问题