ericmdantas / generator-ng-fullstack

Client, server or fullstack - it's up to you. ng-fullstack gives you the best of the latest.
MIT License
704 stars 103 forks source link

[ng2 typings] - gulp fails on a pristine generated app #68

Closed lorenjerickson closed 8 years ago

lorenjerickson commented 8 years ago

Not sure if this is a dupe or corollary issue to https://github.com/ericmdantas/generator-ng-fullstack/issues/65.

Generated a fresh app: fullstack, node, ng2, typescript. Installed missing peer dependencies for angular2 +kerberos. Run gulp. Get the following.

AFAIK, Observable has been used from rxjs since the later ng2 alphas. Don't really have time or energy to figure out why the rest of it is failing. Maybe a more opinionated generator would be a better approach? Less things to go wrong....

[16:53:25] Requiring external module babel-register [16:53:27] Using gulpfile ~\Documents\Source\minimalbits\ng-fullstack\gulpfile.babel.js [16:53:27] Starting 'client.build_ts:dev'... [16:53:27] Starting 'client.browser_sync'... [16:53:27] Finished 'client.browser_sync' after 179 μs C:/Users/loren/Documents/Source/minimalbits/ng-fullstack/node_modules/angular2/src/testing/matchers.d.ts(4,37): error TS 2503: Cannot find namespace 'jasmine'. tests\client\todo\todo_component_test.ts(19,23): error TS2307: Cannot find module '../client/dev/todo/todo_cmp.js'. tests\client\todo\todo_component_test.ts(20,27): error TS2307: Cannot find module '../client/dev/todo/todo_service.js'. tests\client\todo\todo_component_test.ts(58,26): error TS2339: Property 'toBeDefined' does not exist on type 'NgMatchers '. tests\client\todo\todo_component_test.ts(66,9): error TS2304: Cannot find name 'spyOn'. tests\client\todo\todo_component_test.ts(70,34): error TS2339: Property 'toHaveBeenCalled' does not exist on type 'NgMat chers'. tests\client\todo\todo_service_test.ts(7,27): error TS2307: Cannot find module '../client/dev/todo/todo_service'. [16:53:29] TypeScript: 7 semantic errors [16:53:29] TypeScript: emit succeeded (with errors) client\dev\index.ts(4,23): error TS2307: Cannot find module './todo/todo_cmp.js'. client\dev\todo\todo_cmp.ts(14,27): error TS2307: Cannot find module './todo_service.js'. client\dev\todo\todo_service.ts(3,3): error TS2305: Module '"C:/Users/loren/Documents/Source/minimalbits/ng-fullstack/no de_modules/angular2/core"' has no exported member 'Observable'. [16:53:31] TypeScript: 3 semantic errors [16:53:31] TypeScript: emit succeeded (with errors) [16:53:31] Finished 'client.build_ts:dev' after 3.89 s [16:53:31] Starting 'client.watch'... [16:53:31] Finished 'client.watch' after 44 ms [16:53:31] Starting 'default'... [16:53:31] Finished 'default' after 9.96 μs [BS] [info] Proxying: http://localhost:3333 [BS] Access URLs:


   Local: http://localhost:3000
External: http://192.168.1.18:3000

      UI: http://localhost:3001

UI External: http://192.168.1.18:3001


ericmdantas commented 8 years ago

Hello @lorenjerickson!

Thanks for the feedback, I'll take a look at it.

ericmdantas commented 8 years ago

As expected, the problem is related to the typings for jasmine.

I'm also tracking it here: https://github.com/ericmdantas/angular2-typescript-todo/issues/3

lorenjerickson commented 8 years ago

awesome. I will wait eagerly for news.

ericmdantas commented 8 years ago

Turns out this is a bug with ng2's beta2 version.

You can see it here: https://github.com/angular/angular/issues/6813

I'll keep the issue open until they release a fix and I can update to beta3.

ericmdantas commented 8 years ago

I released0 1.6.0-2 yesterday, and it should fix this.

The thing is, you'd have to run tsd install jasmine -so by yourself.

$ tsd install jasmine -so
gulp
tsc
npm start
ericmdantas commented 8 years ago

As explained by Alex (Angular's core team), this is a breaking change and it was meant to be that way. It just was undocumented.

Here is the comment: https://github.com/angular/angular/issues/6817#issuecomment-180016518

Nevergonnachange commented 8 years ago

I am faceing the same issu here.

I created a ng2 fullstack app with node as server side and once it hit gulp default task

The jasmine issue is gone but the page still wont load in my browser.

I get this output:

[23:22:07] Requiring external module babel-core/register
[23:22:12] Using gulpfile ~/workspace/test2/gulpfile.babel.js
[23:22:12] Starting 'client.build_ts:dev'...
[23:22:12] Starting 'client.browser_sync'...
[23:22:12] Finished 'client.browser_sync' after 198 μs
client/dev/index.ts(4,23): error TS2307: Cannot find module './todo/components/todo_cmp.js'.
client/dev/todo/components/todo_cmp.ts(15,27): error TS2307: Cannot find module '../services/todo_service.js'.
[23:22:15] TypeScript: 2 semantic errors
[23:22:15] TypeScript: emit succeeded (with errors)
/home/ngc/workspace/test2/node_modules/angular2/src/testing/matchers.d.ts(4,37): error TS2503: Cannot find namespace 'jasmine'.
tests/client/todo/components/todo_component_test.ts(28,23): error TS2307: Cannot find module '../client/dev/todo/todo_cmp.js'.
tests/client/todo/components/todo_component_test.ts(29,27): error TS2307: Cannot find module '../client/dev/todo/todo_service.js'.
tests/client/todo/components/todo_component_test.ts(69,26): error TS2339: Property 'toBeDefined' does not exist on type 'NgMatchers'.
tests/client/todo/components/todo_component_test.ts(77,9): error TS2304: Cannot find name 'spyOn'.
tests/client/todo/components/todo_component_test.ts(81,34): error TS2339: Property 'toHaveBeenCalled' does not exist on type 'NgMatchers'.
tests/client/todo/services/todo_service_test.ts(9,27): error TS2307: Cannot find module '../client/dev/todo/todo_service'.
[23:22:16] TypeScript: 7 semantic errors
[23:22:16] TypeScript: emit succeeded (with errors)
[23:22:16] Finished 'client.build_ts:dev' after 4.28 s
[23:22:16] Starting 'client.watch'...
[23:22:16] Finished 'client.watch' after 48 ms
[23:22:16] Starting 'default'...
[23:22:16] Finished 'default' after 3.92 μs
[BS] [info] Proxying: http://localhost:3333
[BS] Access URLs:
 ---------------------------------------
       Local: http://localhost:3002
    External: http://192.168.178.21:3002
 ---------------------------------------
          UI: http://localhost:3003
 UI External: http://192.168.178.21:3003
 ---------------------------------------
ericmdantas commented 8 years ago

@Nevergonnachange hello!

After running gulp, are you running npm start?

Nevergonnachange commented 8 years ago

Oh what a stupid mistake. Page loads now but still dont display anything. Im getting a Stacktrace in the console.


EXCEPTION: Template parse errors:
Unexpected closing tag "head" ("/bundles/http.js"></script>
    <script src="node_modules/angular2/bundles/router.js"></script>
  [ERROR ->]</head>
  <body>

"): TodoCmp@18:2
Unexpected closing tag "html" ("

  </body>
[ERROR ->]</html>
"): TodoCmp@26:0
angular2.js:22911 EXCEPTION: Template parse errors:
Unexpected closing tag "head" ("/bundles/http.js"></script>
    <script src="node_modules/angular2/bundles/router.js"></script>
  [ERROR ->]</head>
  <body>

"): TodoCmp@18:2
Unexpected closing tag "html" ("

  </body>
[ERROR ->]</html>
"): TodoCmp@26:0BrowserDomAdapter.logError @ angular2.js:22911BrowserDomAdapter.logGroup @ angular2.js:22922ExceptionHandler.call @ angular2.js:1182(anonymous function) @ angular2.js:12562NgZone._notifyOnError @ angular2.js:13485collection_1.StringMapWrapper.merge.onError @ angular2.js:13389Zone.run @ angular2-polyfills.js:1247(anonymous function) @ angular2.js:13408zoneBoundFn @ angular2-polyfills.js:1220lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:468lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:480lib$es6$promise$$internal$$publish @ angular2-polyfills.js:451(anonymous function) @ angular2-polyfills.js:123microtask @ angular2.js:13440Zone.run @ angular2-polyfills.js:1243(anonymous function) @ angular2.js:13408zoneBoundFn @ angular2-polyfills.js:1220lib$es6$promise$asap$$flush @ angular2-polyfills.js:262
angular2.js:22911 STACKTRACE:BrowserDomAdapter.logError @ angular2.js:22911ExceptionHandler.call @ angular2.js:1184(anonymous function) @ angular2.js:12562NgZone._notifyOnError @ angular2.js:13485collection_1.StringMapWrapper.merge.onError @ angular2.js:13389Zone.run @ angular2-polyfills.js:1247(anonymous function) @ angular2.js:13408zoneBoundFn @ angular2-polyfills.js:1220lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:468lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:480lib$es6$promise$$internal$$publish @ angular2-polyfills.js:451(anonymous function) @ angular2-polyfills.js:123microtask @ angular2.js:13440Zone.run @ angular2-polyfills.js:1243(anonymous function) @ angular2.js:13408zoneBoundFn @ angular2-polyfills.js:1220lib$es6$promise$asap$$flush @ angular2-polyfills.js:262
angular2.js:22911 Error: Template parse errors:
Unexpected closing tag "head" ("/bundles/http.js"></script>
    <script src="node_modules/angular2/bundles/router.js"></script>
  [ERROR ->]</head>
  <body>

"): TodoCmp@18:2
Unexpected closing tag "html" ("

  </body>
[ERROR ->]</html>
"): TodoCmp@26:0
    at new BaseException (http://localhost:3000/node_modules/angular2/bundles/angular2.js:7325:21)
    at TemplateNormalizer.normalizeLoadedTemplate (http://localhost:3000/node_modules/angular2/bundles/angular2.js:19857:15)
    at http://localhost:3000/node_modules/angular2/bundles/angular2.js:19846:24
    at Zone.run (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1243:24)
    at Zone.run (http://localhost:3000/node_modules/angular2/bundles/angular2.js:13408:32)
    at zoneBoundFn (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1220:26)
    at lib$es6$promise$$internal$$tryCatch (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:468:17)
    at lib$es6$promise$$internal$$invokeCallback (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:480:18)
    at lib$es6$promise$$internal$$publish (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:451:12)
    at http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:123:10

-----async gap-----
Error
    at _getStacktraceWithUncaughtError (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:2236:29)
    at Zone.fork (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:2285:47)
    at Zone.bind (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1218:53)
    at bindArguments (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1401:36)
    at lib$es6$promise$promise$$Promise.obj.(anonymous function) [as then] (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1413:46)
    at TemplateNormalizer.normalizeTemplate (http://localhost:3000/node_modules/angular2/bundles/angular2.js:19845:44)
    at TemplateCompiler.normalizeDirectiveMetadata (http://localhost:3000/node_modules/angular2/bundles/angular2.js:24059:39)
    at http://localhost:3000/node_modules/angular2/bundles/angular2.js:24132:24
    at Array.map (native)
    at TemplateCompiler._compileComponentRuntime (http://localhost:3000/node_modules/angular2/bundles/angular2.js:24131:134)

-----async gap-----
Error
    at _getStacktraceWithUncaughtError (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:2236:29)
    at Zone.fork (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:2285:47)
    at NgZone._createInnerZone (http://localhost:3000/node_modules/angular2/bundles/angular2.js:13396:39)
    at new NgZone (http://localhost:3000/node_modules/angular2/bundles/angular2.js:13262:32)
    at createNgZone (http://localhost:3000/node_modules/angular2/bundles/angular2.js:12446:12)
    at PlatformRef_.application (http://localhost:3000/node_modules/angular2/bundles/angular2.js:12521:31)
    at Object.bootstrap (http://localhost:3000/node_modules/angular2/bundles/angular2.js:24631:64)
    at execute (http://localhost:3000/client/dev/index.js:15:23)
    at u (http://localhost:3000/node_modules/systemjs/dist/system.js:5:3446)
    at Object.execute (http://localhost:3000/node_modules/systemjs/dist/system.js:5:6334)
ericmdantas commented 8 years ago

I got that too, working on it.

PS: it's already fixed on master, just fixing some minor stuff. PS2: published 1.6.0-3 so the application starts with ng2, still working on the typings, though.

christianmenz commented 8 years ago

Maybe this goes into the same direction, I can't get my fullstack app started as well. Here are some details:

Generator options:

I'm running gulp, tsc and then npm start. I noticed just running tsc like described above does not compile the server part, I need to cd into server first and then run tsc server.ts. But the compiled js seems to be invalid:

todo-dao.js:34 void ; ^

SyntaxError: Unexpected token ;

I have no clue why the tsconfig.js seems to be ignored when just running tsc. Am I missing something or is something wrong with the versions?

ericmdantas commented 8 years ago

Hello, @christianmenz! The server side thing is a different issue, let's discuss it here #78.

ericmdantas commented 8 years ago

1.6.0-12 released with the fix.

Keep in mind the typescript server stuff is still a known bug, I'll work on it now.