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

NGC Build Error #91

Closed
danbucholtz opened this issue Oct 5, 2016 · 7 comments
Closed

NGC Build Error #91

danbucholtz opened this issue Oct 5, 2016 · 7 comments

Comments

@danbucholtz
Copy link

When I try to build this library with ngc, I get an error:

23:10:05]  tslint: /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/src/app/app.module.ts[28, 10]: Unused import: 'MomentModule'

[23:10:05]  lint finished in 376 ms
[23:10:11]  ngc error: Error: Error at /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/angular2-moment/CalendarPipe.d.ts:16:36: Module ''moment'' has no exported member 'Moment'.
Error at /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/angular2-moment/DateFormatPipe.d.ts:5:36: Module ''moment'' has no exported member 'Moment'.
Error at /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/angular2-moment/TimeAgoPipe.d.ts:9:36: Module ''moment'' has no exported member 'Moment'.
Error at /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/angular2-moment/TimeAgoPipe.d.ts:12:51: Module ''moment'' has no exported member 'Moment'.
Error at /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/angular2-moment/DifferencePipe.d.ts:5:36: Module ''moment'' has no exported member 'Moment'.
Error at /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/angular2-moment/DifferencePipe.d.ts:5:70: Module ''moment'' has no exported member 'Moment'.
Error at /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/angular2-moment/DifferencePipe.d.ts:5:92: Module ''moment'' has no exported member 'UnitOfTime'.
    at check (/Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/@angular/tsc-wrapped/src/tsc.js:31:15)
    at Tsc.typeCheck (/Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/@angular/tsc-wrapped/src/tsc.js:86:9)
    at /Users/dan/Dev/rollup-lib-issues/mega-lib-trail/node_modules/@angular/tsc-wrapped/src/main.js:33:23
    at process._tickCallback (node.js:369:9)
    at Function.Module.runMain (module.js:443:11)
    at startup (node.js:139:18)
    at node.js:974:3

[23:10:11]  ngc error: Compilation failed

Thanks,
Dan

@gaaamii
Copy link

gaaamii commented Oct 5, 2016

I got the same error though I don't use ngc.

ERROR in [default] node_modules/angular2-moment/DifferencePipe.d.ts:5:91
Module 'moment' has no exported member 'UnitOfTime'.

@danbucholtz
Copy link
Author

It is actually just a Typescript error. Ngc runs Tsc after it does it's thing.

Thanks,
Dan

@gaaamii
Copy link

gaaamii commented Oct 5, 2016

This problem was solved by re-installing definition file.

When I first tried to install that, I installed definition file of moment with typings like below.

npm install --save --global moment

But I found the below is right.

typings install --save moment

So I removed this definition file.

typings prune

And re-installed that.

typings install --save moment

And now everything is fine.

@aamcatamney
Copy link

I'm unable to install the typings as anything other than a global.
I have found that the "1.0.0-beta.1" version complies correctly.

@urish
Copy link
Owner

urish commented Oct 5, 2016

@danbucholtz did you install @types/moment ? which version of if?

@danbucholtz
Copy link
Author

Hi @urish,

I did not try to track down the issue. If @types/moment is a dependency of your lib, the best bet may be to list it in the package.json dependencies. In theory, if all the types are listed there, everything will just work!

Thanks,
Dan

@urish
Copy link
Owner

urish commented Oct 6, 2016

@danbucholtz thanks for the tip, done and released as 1.0.0-beta.4

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

4 participants