Angular.js Module has no exported member error

If you are working with beta version of angular js you might experience Module has no exported member error.

That usually happens when you try to import a module using below syntax

import { NgModule }      from ‘@angular/core’;

The actual reason this error is flashing is due to Typescript is not able to find right dependency to import it. However behind the scene there might issue like

  1. Corresponding code have some error and was not compiled well
  2. Or the dependency you are trying to import is actually missing

If #1 is the case then to over come the situation you might need to fix the error (generally that is due to syntax error) so that code complies and dependency become available

If #2 is the case then you might want to update the dependencies. It can be npm module or any other custom dependency

In my case i updated @angular/core to “@angular/core”:  “2.0.0-rc.5” in package.json because NgModule become available “2.0.0-rc.5” onwards

Once that was done i run
npm update
so that required dependencies can be updated.

General note to avoid confusion – If you are using tools like Visual studio then you might notice that your dependency is still underlines in red. You can simply close the editor or the file to get rid of that confusion 🙂

!!Happy coding!!
Tarun Juneja


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s