opencredo / angular2-boilerplate

24 stars 14 forks source link

compile-ts task not working #1

Open mgcrea opened 9 years ago

mgcrea commented 9 years ago

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 angular2@2.0.0-alpha.30 but it did not solve the issue

SuNR0N commented 9 years ago

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

wrench7 commented 9 years ago

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.

SuNR0N commented 9 years ago

@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.

wrench7 commented 9 years ago

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