angular2-boilerplate icon indicating copy to clipboard operation
angular2-boilerplate copied to clipboard

compile-ts task not working

Open mgcrea opened this issue 9 years ago • 4 comments

Just cloned your project, bower i, npm i and gulp and I get:

[15:46:32] Starting 'compile-ts'...
src/webapp/app/bootstrap.ts(7,33): error TS2307: Cannot find external module 'angular2/router'.
src/webapp/app/common/formInjectables.ts(3,27): error TS2307: Cannot find external module 'angular2/forms'.
src/webapp/app/pages/create/create-book.ts(5,78): error TS2307: Cannot find external module 'angular2/forms'.
src/webapp/app/pages/create/create-book.ts(6,22): error TS2307: Cannot find external module 'angular2/router'.
src/webapp/app/pages/edit/edit-book.ts(5,78): error TS2307: Cannot find external module 'angular2/forms'.
src/webapp/app/pages/edit/edit-book.ts(6,27): error TS2307: Cannot find external module 'angular2/router'.
src/webapp/app/pages/edit/edit-book.ts(7,22): error TS2307: Cannot find external module 'angular2/di'.
src/webapp/app/pages/list/list-books.ts(6,22): error TS2307: Cannot find external module 'angular2/router'.
src/webapp/app/pages/pages.ts(5,61): error TS2307: Cannot find external module 'angular2/router'.
src/webapp/app/pages/pages.ts(6,31): error TS2307: Cannot find external module 'angular2/src/router/browser_location'.
src/webapp/app/pages/view/view-book.ts(5,27): error TS2307: Cannot find external module 'angular2/router'.
src/webapp/app/pages/view/view-book.ts(6,22): error TS2307: Cannot find external module 'angular2/di'.
src/webapp/app/services/BookService.ts(3,22): error TS2307: Cannot find external module 'angular2/di'.
src/webapp/app/services/BookService.ts(4,66): error TS2307: Cannot find external module 'angular2/http'.

I don't see any angular2 source being pulled somewhere (except the script from the cdn inside index.html).

Tried $ npm i [email protected] but it did not solve the issue

mgcrea avatar Jul 11 '15 13:07 mgcrea

Hi! I only get the exact same error you have if the custom angular 2 type definitions file (typings/_custom/ng2.d.ts) is missing or not referenced properly, because the modules that the compiler complains about are defined in that file.

Can you please make sure that:

  1. You have the ng2.d.ts file in typings/_custom directory
  2. You have the following line in typings/_custom/custom.d.ts: ///
  3. You have the following line in typings/tsd.d.ts: ///

Note: Only 2 angular source files are needed which are fetched from CDN and referenced in the index.html and of course the type definitions

SuNR0N avatar Jul 11 '15 20:07 SuNR0N

I have a similar issue after cloning the repo and bower and npm installing:

[19:08:06] Starting 'compile-ts'...
src/webapp/app/pages/create/create-book.ts(75,21): error TS2339: Property 'parent' does not exist on type 'Router'.
src/webapp/app/pages/list/list-books.ts(33,21): error TS2339: Property 'parent' does not exist on type 'Router'.
src/webapp/app/pages/list/list-books.ts(37,21): error TS2339: Property 'parent' does not exist on type 'Router'.
src/webapp/app/services/BookService.ts(4,66): error TS2307: Cannot find external module 'angular2/http'.

I can see that for the last error in the list there is no http module declared in the ng2.d.ts file. I'm not sure why the other files are complaining about parent not existing in Router.

Any help would be appreciated.

wrench7 avatar Jul 27 '15 18:07 wrench7

@wrench7 They were just semantic errors, but good point. I've just added the missing type definitions to ng2.d.ts. It should be fine now.

SuNR0N avatar Jul 27 '15 18:07 SuNR0N

Great, thanks alot! I was having a separate issue with EADDRINUSE (which I've now resolved) so everything's running now :-)

wrench7 avatar Jul 28 '15 08:07 wrench7