我正在使用https://github.com/maximegris/angular-electron样板启动电子应用程序。在克隆之后,为了开始设置autoUpdater,我只做了以下两个更改:
安装电子更新程序:npm install electron-updater --save
并在main.ts文件中的下一行:
import { autoUpdater } from 'electron-updater';在此之后,当我尝试启动应用程序时,我得到以下错误:
node_modules/electron-updater/node_modules/builder-util-runtime/out/httpExecutor.d.ts(2,27): error TS2305: Module '"http"' has no exported member 'OutgoingHttpHeaders'.
node_modules/electron-updater/out/AppUpdater.d.ts(4,10): error TS2305: Module '"http"' has no exported member 'OutgoingHttpHeaders'.
node_modules/electron-updater/out/Provider.d.ts(3,10): error TS2305: Module '"http"' has no exported member 'OutgoingHttpHeaders'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! angular-electron@2.6.0 build:electron:main: `tsc main.ts --outDir dist && copyfiles package.json dist && cd dist && npm install --prod && cd ..`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular-electron@2.6.0 build:electron:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/harshveer/.npm/_logs/2018-02-13T09_30_46_752Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! angular-electron@2.6.0 electron:serve: `npm run build:electron:main && electron ./dist --serve`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular-electron@2.6.0 electron:serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/harshveer/.npm/_logs/2018-02-13T09_30_46_777Z-debug.log
ERROR: "electron:serve" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-electron@2.6.0 start: `npm-run-all --parallel webpack:watch electron:serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-electron@2.6.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/harshveer/.npm/_logs/2018-02-13T09_30_46_902Z-debug.log知道怎么解决这个问题吗,
发布于 2018-02-21 04:38:56
采用这种方式导入electron-updater模块:const autoUpdater = require("electron-updater").autoUpdater解决了这个问题。我错过了医生的报告:
使用来自电子更新程序的autoUpdater,而不是电子:
import { autoUpdater } from "electron-updater"或者如果您不使用ES6:const autoUpdater = require("electron-updater").autoUpdater
发布于 2018-02-21 16:35:01
如果有人遇到这个问题,请讨论这里。
https://stackoverflow.com/questions/48763721
复制相似问题