Skip to content
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 in ./node_modules/countup.js-angular2/countUp.module.ts #6

Closed
Farre82 opened this issue Jan 19, 2018 · 10 comments
Closed

ERROR in ./node_modules/countup.js-angular2/countUp.module.ts #6

Farre82 opened this issue Jan 19, 2018 · 10 comments

Comments

@Farre82
Copy link

Farre82 commented Jan 19, 2018

Module build failed: Error: C:\XXX\node_modules\countup.js-angular2\countUp.directive.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include'
property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).

@inorganik
Copy link
Owner

How are you including the countUp.js-angular2 module?

@Farre82
Copy link
Author

Farre82 commented Jan 20, 2018

Hi,
I' m using angular 5 and is including countup.js in my sharedModule like this.

`import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { CountUpModule } from "countup.js-angular2";

@NgModule({
imports: [
CommonModule,
FormsModule,
CountUpModule
],
declarations: [
],
exports: [
CommonModule,
FormsModule,
CountUpModule,
]
})
export class SharedModule { }
`

@Farre82
Copy link
Author

Farre82 commented Jan 21, 2018

Hi again,
I think it have to do with Angular 5 and AOT.
See this link AOT

@inorganik
Copy link
Owner

Gonna need some more info please. What angular version, cli version, and countup.js-angular2 version are you using? I successfully included it in a project using these latest (at time of writing) versions:

Angular: 5.2.0
Angular CLI: 1.6.5
count Up Angular2: 1.1.1

At the very least, make sure you have the most recent countup.js-angular2 version, 1.1.1.

@valdenio
Copy link

The problem appears when we try to compile for production (in my case it's in Ionic, but i think it's the same problem of the others). The Angular compiler (version 5.2.9 in my case) is looking for the compiled js files, but in the npm module there are only the typescript files.

@inorganik
Copy link
Owner

I am able to successfully compile my test project with ng build --prod.

In the dist folder, everything is compiled down to js.

@iplaksiy
Copy link

iplaksiy commented May 10, 2018

Having the same issue now that I upgraded to v6.

ng build --prod

ERROR in ./node_modules/countup.js-angular2/countUp.directive.ts
Module build failed: Error: countUp.directive.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
    at AngularCompilerPlugin.getCompiledFile 

Angular 6.0.0
Angular CLI: 6.0.0
CountUp: 1.1.1

It was building fine in v5.*, but it looks like with the upgrade, that's no longer the case.

EDIT:
In the meantime, I was able to find a workaround by adding the following to the end of tsconfig.json, just as the error suggests:

"include": [
    "./src"
  ],
  "files": [
    "node_modules/countup.js-angular2/countUp.module.ts",
    "node_modules/countup.js-angular2/countUp.directive.ts"
  ]

With that in place, my projects builds fine with ng build --prod

@mjacobson7
Copy link

Any word on this? I am experiencing this as well. As @iplaksiy noted, the error message says the following:

Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).

@inorganik
Copy link
Owner

For now, use @iplaksiy's solution. I tried rerunning a newer version of ng-packagr, and it results in an AOT error:

ERROR in : Unexpected value 'CountUpModule in /.../node_modules/countup.js-angular2/countUp.module.d.ts' imported by the module 'AppModule in /.../src/app/app.module.ts'. Please add a @NgModule annotation.

Angular still hasn't figured out a good way to pass directives around via npm. Of course, you can always just copy the count-up directive in this repo and declare it in app.module.ts. It's really that simple! But due to all the complicated webpack bundling, transpiling, etc, we have to jump through so many hoops if we want to just npm install it. * sigh *

@inorganik
Copy link
Owner

Fixed in v6.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants