错误TS2305:模块'没有出口成员的“外向成员”.试图将电子 - 上升添加到电子项目中时



我正在使用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

任何想法如何解决此问题,

以这种方式导入electron-updater模块:const autoUpdater = require("electron-updater").autoUpdater解决了问题。我错过了文档:

使用来自电子 - 上dater而不是电子的自oupdater:

import { autoUpdater } from "electron-updater"

或者如果不使用ES6:const autoUpdater = require("electron-updater").autoUpdater

在这里讨论如果有人遇到问题。

最新更新