Here I am again, hoping to find a quick solution to this:
Link <- Click on this link to see the folder structure
//main.ts
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './home.main';
import {InputComponent} from './home.controller';
import {enableProdMode} from 'angular2/core';
bootstrap(InputComponent);
bootstrap(AppComponent);
This is my main.ts file where I import the AppComponent from home main, now the home.main looks like this:
import {Component} from 'angular2/core';
@Component({
selector:'home',
templateUrl:'/index/index.ejs'
})
export class InputComponent {
name = 'test';
}
However, when I run this, I get: error TS2305: Module '"controllers/home/home.main"' has no exported member 'AppComponent'. ( Same goes for home.controller ).
Thank you, Alex S.
@grosch That may happen if there's multiple versions of Angular present in node_modules, i.e. some dependency has a direct dependency (instead of a peer dependency) on an older version of Angular. You can figure this out using npm ls @angular/core. Sorry, something went wrong. @JoostK Thank you so much! Sorry, something went wrong.
The error that you get is a TypeScript error, not a Angular one, and it is correct in stating that there is no exported member, as it searches for a valid EC6 syntax for export, not angular module export. This line would thus work in your app.component.ts: import { SigninComponent } from './auth/components/signin.component';
Is this a regression? Running ng build/serve after updating to angular 9 produces a number of errors, all surrounding an export in angular/core
This is not compatible, and it's not meant to be. As of right now, libraries should be published with Ivy disabled, otherwise their compatibility with Angular versions, both older and upcoming versions is highly crippled. The reason is that Ivy's generated code (its instruction set) is not set in stone yet, so changes are to be expected.
I had this issue even when I had correctly exported the class on my other file. Rebooting my machine fixed it.
If you see this error in any @angular modules like router, core, then make sure it is because of the version mismatch of the libraries. Generally all your @angular modules should be of the same version except router.
for Ex:
"@angular/common": "2.2.3",
"@angular/compiler": "2.2.3",
"@angular/core": "2.2.3",
"@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "2.2.3",
"@angular/router": "^3.3.0" <= Version mismatch***
the following combination throws following error
has no exported member
I changed the router version to
"@angular/router": "^3.0.0"
The error is resolved.
So, until everything is stable stick with your working combination.
You should have something like that in your home.main module:
@Component({
(...)
})
export class AppComponent {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With