一只开发狗001 2020-03-15 19:52 采纳率: 22.2%
浏览 178
已结题

electron-builder打包+electron-updater在线更新的项目打包各种报错,求指教咋回事?

下面是我的package.js中的配置:

{
  "name": "**",
  "version": "2.0.0",
  "description": "**",
  "main": "main.js",
  "scripts": {
     "build": "electron-builder",
     "build:dir": "electron-builder --dir"
},
  "devDependencies": {
    "electron": "^8.1.1",
    "electron-builder": "^22.4.1",
    "electron-updater": "^4.2.5"
  },
  "build": {
    "productName":"***",
    "appId": "com.***",
    "copyright":"**",
    "directories": {
      "output": "build"
    },
    "asar": false,
    "nsis": {
      "oneClick": false,
      "allowElevation": true,
      "allowToChangeInstallationDirectory": true,
      "installerIcon": "clientLogo.ico",
      "uninstallerIcon": "clientLogo.ico",
      "installerHeaderIcon": "clientLogo.ico",
      "createDesktopShortcut": true,
      "createStartMenuShortcut": true,
      "shortcutName": "***",
      "include": "build/script/installer.nsh"
    },
    "publish": [
      {
        "provider": "generic",
        "url": "C:\\Users\\Shinelon\\Desktop\\*****\\myApp"
      }
    ],
    "files": [
      "dist/electron/**/*"
    ],
    "dmg": {
      "contents": [
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"

        },
        {

          "x": 130,
          "y": 150,
          "type": "file"
        }
      ]
    },
    "win": {
      "icon": "clientLogo.ico",
      "target": [
        {
          "target": "nsis"
        }
      ]
    },
    "linux": {
      "icon": "build/icons"
    }

  }
}


下面是我的错误日志:

9 verbose lifecycle '项目'@2.0.0~build: CWD: C:\Users\Shinelon\Desktop\'项目'在线更新版本测试\'项目'(在线更新版本测试)

10 silly lifecycle '项目'@2.0.0~build: Args: [ '/d /s /c', 'electron-builder' ]

11 silly lifecycle '项目'@2.0.0~build: Returned: code: 1 signal: null

12 info lifecycle '项目'@2.0.0~build: Failed to exec build script

13 verbose stack Error: '项目'@2.0.0 build: `electron-builder`

13 verbose stack Exit status 1

13 verbose stack   at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)

13 verbose stack   at EventEmitter.emit (events.js:321:20)

13 verbose stack   at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)

13 verbose stack   at ChildProcess.emit (events.js:321:20)

13 verbose stack   at maybeClose (internal/child_process.js:1021:16)

13 verbose stack   at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

14 verbose pkgid '项目'@2.0.0

15 verbose cwd C:\Users\Shinelon\Desktop\'项目'在线更新版本测试\'项目'(在线更新版本测试)

16 verbose Windows_NT 10.0.17134

17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"

18 verbose node v12.16.0

19 verbose npm v6.13.4

20 error code ELIFECYCLE

21 error errno 1

22 error '项目'@2.0.0 build: `electron-builder`

22 error Exit status 1

23 error Failed at the '项目'@2.0.0 build script.

23 error This is probably not a problem with npm. There is likely additional logging output above.

24 verbose exit [ 1, true ]


ps:再上面几条粘不开了





















































































































































  • 写回答

3条回答 默认 最新

  • sh_c_1314 2020-03-16 15:44
    关注

    可能是版本的问题

    1. 卸载npm uninstall webpack-dev-server

    然后 npm i -D webpack-dev-server@3.0.0


    再 npm run dev 试试


    2.重新安装一次,如果还是不可以的话,在把之前装的都清空


    rm -rf node_modules

    rm package-lock.json

    npm cache clear --force

    npm install


    评论

报告相同问题?

悬赏问题

  • ¥15 我想在一个软件里添加一个优惠弹窗,应该怎么写代码
  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流