-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error loading npm linked custom library with aot #3854
Comments
Having a very similar issue here with a similar setup. I'd love to see someone respond to this. |
Are tree. |
Where is this makeDecorator function? is it a part of your project? |
I had a similar problem and it was caused by a small project which I imported and didn't appear to be prepared for aot yet. The makeDecorator function wasn't part of the project code either. |
I have the same problem getting this error. This error is thrown when I try to import a module coming outside my angular-cli root. Doesn't matter if I use the source .ts file or the compiled version. Also happens when linking with yarn link. |
As far as I can tell now, there is definitely a problem with imported modules outside the projects root. When I use This means it is not possible to use self-written libs with angular-cli currently, unless they are already published somewhere. Hope this gets fixed soon. |
@SebastianSchenk check this one as an example, I had the same issue but this example seems currently working fine. npm install https://github.com/msusur/angular-lib-exp.git --save @NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
AngularLibExpModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { } <h1>
{{title}}:
{{ 3.23 | roundDown }}
<cm-display [message]="title"></cm-display>
</h1> |
@msusur thank your for the example. Using .forRoot helps as a workaround to avoid the error. To sum it up. The error occurs only when the lib also contains node_modules. I think it has something to do with @angular/* being a in both node_modules. |
@SebastianSchenk I was having a very similar issue with a feature module I am building under it's own dependency. With you're hypothesis, I removed my I'm getting a bunch of errors in my feature module since none of it's dependencies are present... but that more or less add to an issue with duplication in the |
@jppellerin I had the same issue, removing |
It seems like this is a issue caused by Typescript and not by Angular CLI. Typescript has problems resolving dependencies when For now, thanks to this post #1858 I found a good workaround, which doesn't affect the actual code of the library, as it is the case with an empty Here is my full tsconfig.json:
|
Closing as it has been answered. Great writeup and workaround by @SebastianSchenk ! |
I edited the title and added the FAQ label to make it easier for people having the same problem to find this. |
@SebastianSchenk perhaps worth noting: Your solution (which resolved this issue for me - a million thanks) can be rewritten as:
|
Hi, Anybody is albe to explain what is the real cause? I have added that path mapping and it resolves my problem. But I think this is not really a solution as more workaround. When I create new project using ng new XXXX, simulate identical setup All is fine and I dont have a issue. |
I wasn't able to resolve it via @SebastianSchenk 's workaround. I have the following error: Error encountered resolving symbol values statically. Calling function 'makeParamDecorator', function calls are not supported. I'm using Angular 4.1.3 with Angular-CLI 1.0.2 and Ionic 3.4.2. The error shows up when I try to run the following command:
|
The workaround does not work here. As soon as i add the import { localStorageSync } from 'ngrx-store-localstorage'; AND StoreModule.forRoot(
reducers, {
metaReducers: [
localStorageSync({
keys: ['auth', 'customer']})
]
}
),
```
It fails with the error above. Adding the modules to tsconfig does not solve the problem. As soon as i save the project it compiles successfully. |
This paths: { "@angular/": ["../node_modules/@angular/"] } workaround didn't work for me. Please help :( |
Building with aot, using The error I get (at runtime) is:
Looks like this is an open issue with angular-cli |
Workaround with export const reducers = {
tips: collectionReducer('tips'),
games: collectionReducer('games'),
eventTypes: collectionReducer('eventTypes'),
}
|
I've encountered this error when having a dependency installed from the local file directory. NPM5 creates a symlink which doesn't seem to want to play nice with the AOT compiler. I solved it by downgrading to NPM3 with Hopefully, this helps someone else down the road. |
It looks like npm@5 intentionally broke this: npm/npm#15900 |
@Polyergic So what would be the fix now? I'm struggling... |
@chrillewoodz, for the time being I'm both avoiding |
just a note, this "paths" needs to be added to your tsconfig.json on your app , not your library folder, in case you are building a custom module. SebastianSchenk answer works for me. |
SebastianSchenk's answer does not work for me unfortunately. I am on v6.0.0 of everything. The error I am getting is
I am not using The component that it is complaining about is very simple. It just has a couple of |
@rtm |
@alexzuza Thanks for following up, but this problem magically solved itself, no idea how. |
So maybe it's a VS Code thing or npm thing, I don't know, but somehow the file paths to our symlink'ed modules had their direct paths added (../../../patient/node_modules/*). We spent quite awhile trying to hunt down this issue, and apparently an automated process re-wrote the file paths in app.module.ts. SHOULD BE:
OVERWRITTEN FILE PATHS:
|
For my case it is "@angular/*": ["./node_modules/@angular/*"] instead of "@angular/*": ["../node_modules/@angular/*"] in tsconfig.json. Then it works. 💯 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
Mac OSX, El Capitan
Versions.
Repro steps.
From a really fresh angular cli project.
Only adding in app.module.ts :
Adding one of the component in app.component.html
<my-message type="error">This is an error message</my-message>
And running
ng build --aot
The log given by the failure.
Mention any other details that might be useful.
My message module declare and exports the message component, with inlined css/html.
It's Exported with a forRoot :
my_lib is generated with ngc, with a .metadata.json near each d.ts.
With following tsconfig parameters :
The text was updated successfully, but these errors were encountered: