Join the Stack Overflow Community
Stack Overflow is a community of 6.3 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I'm getting an error where TypeScript is not recognizing the exported 'bootstrap' function from platform-browser-dynamic.

ERROR in [default] ../retain-app/src/main.ts:1:9 
Module '"../retain-app/node_modules/@angular/platform-browser-dynamic/index"' has no exported member 'bootstrap'.

I imported bootstrap in main.ts like so:

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

This is the dependency in the package.json:

"@angular/platform-browser-dynamic": "^2.0.0",

Any help is appreciated!

share|improve this question
up vote 3 down vote accepted

Bootstrapping is done a little different with the final version, as opposed to some earlier RCs/betas. We no longer use bootstrap. You should instead import the function platforBrowserDynamic, and load the app module with that function

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

import { AppModule } from './your.app.module.location';

platformBrowserDynamic().bootstrapModule(AppModule);

If you are going off an older tutorial that's not using modules, you may want to just check out the Angular Quickstart. At least the second half (after all the environment setup) where it shows how to use a module.

share|improve this answer
    
Perfect. Thanks for the update! Thoroughly appreciated :) – Michael Schlecht Sep 27 at 13:08
    
Thank @peeskillet so much! You saved my time. – Hieu Tran AGI Sep 29 at 8:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.