typescript Angular2“无导出成员引导程序”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39314731/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 03:49:04  来源:igfitidea点击:

Angular2 "no exported member bootstrap" error

angulartypescript

提问by refactor

My Atom editor shows:

我的 Atom 编辑器显示:

Module '"C:/express4/node_modules/@angular/platform-browser-dynamic/index"' has no exported member 'bootstrap'.at line 2 col 10

模块 '"C:/express4/node_modules/@angular/platform-b​​rowser-dynamic/index"' 没有导出成员 'bootstrap'.at line 2 col 10

For the below import in a TypeScript file:

对于 TypeScript 文件中的以下导入:

import { bootstrap } from '@angular/platform-browser-dynamic';

Any idea what could be the reason for this warning?

知道这个警告的原因是什么吗?

回答by Godfather

Assuming you are on Angular RC6/RC5, you can try below code:

假设您使用的是 Angular RC6/RC5,您可以尝试以下代码:

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);

回答by Cyberto

I am using ionic2 rc0 and had to add following dependencies as described here https://github.com/driftyco/ionic2-app-base/blob/master/package.json#L15-L24

我正在使用 ionic2 rc0 并且必须添加以下依赖项,如下所述https://github.com/driftyco/ionic2-app-base/blob/master/package.json#L15-L24

"@angular/common": "^2.0.0",
"@angular/compiler": "^2.0.0",
"@angular/compiler-cli": "^0.6.2",
"@angular/core": "^2.0.0",
"@angular/forms": "^2.0.0",
"@angular/http": "^2.0.0",
"@angular/platform-browser": "^2.0.0",
"@angular/platform-browser-dynamic": "^2.0.0",
"@angular/platform-server": "^2.0.0",