首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误TS2305:模块“http”没有导出成员‘OutgoingHttpHeader’。当试图在电子项目中添加电子更新程序时

错误TS2305:模块“http”没有导出成员‘OutgoingHttpHeader’。当试图在电子项目中添加电子更新程序时
EN

Stack Overflow用户
提问于 2018-02-13 09:44:48
回答 2查看 2.7K关注 0票数 3

我正在使用https://github.com/maximegris/angular-electron样板启动电子应用程序。在克隆之后,为了开始设置autoUpdater,我只做了以下两个更改:

安装电子更新程序:npm install electron-updater --save

并在main.ts文件中的下一行:

代码语言:javascript
复制
import { autoUpdater } from 'electron-updater';

在此之后,当我尝试启动应用程序时,我得到以下错误:

代码语言:javascript
复制
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

知道怎么解决这个问题吗,

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 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

票数 3
EN

Stack Overflow用户

发布于 2018-02-21 16:35:01

如果有人遇到这个问题,请讨论这里

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48763721

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档