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

errors after running 'gulp' command #98

Closed ranbuch closed 8 years ago

ranbuch commented 8 years ago

After using 'yeoman' to generate the project and typing 'gulp' i'm getting a lot of errors:

[14:49:37] Finished 'client.browser_sync' after 622 μs client\dev\todo\components\todo-cmp.ts(3,3): error TS2305: Module '"c:/Users/ranbu/Documents/dev/fitix-selling-point/node_modules/angular2/core"' has no exported member 'View'. c:/Users/ranbu/Documents/dev/fitix-selling-point/node_modules/angular2/src/testing/matchers.d.ts(4,37): error TS2503: Cannot find namespace 'jasmine'. tests\client\todo\components\todo-cmp_test.ts(1,1): error TS6053: File 'c:/Users/ranbu/Documents/dev/fitix-selling-point/typings/main.d.ts' not found. tests\client\todo\components\todo-cmp_test.ts(63,26): error TS2339: Property 'toBeDefined' does not exist on type 'NgMatchers'. tests\client\todo\components\todo-cmp_test.ts(71,9): error TS2304: Cannot find name 'spyOn'. tests\client\todo\components\todo-cmp_test.ts(75,34): error TS2339: Property 'toHaveBeenCalled' does not exist on type 'NgMatchers'. tests\client\todo\services\todo-service_test.ts(1,1): error TS6053: File 'c:/Users/ranbu/Documents/dev/fitix-selling-point/typings/main.d.ts' not found. [14:49:41] TypeScript: 7 semantic errors . . . . . In the end it open's the browser with this URL: http://localhost:3000/ but getting timeout or something . . . Any idea what am I doing wrong?

I'm running nodejs version 4.4.1 by the way.

ericmdantas commented 8 years ago

Those errors are supposed to be fixed in 1.6 stable, could you install the latest version?

Also, what versions do you have for:

As for the timeout, you'll have to run gulp in one terminal and then npm start in another. Those are the live-reload and the server.

ericmdantas commented 8 years ago

Here's the old issue about it: https://github.com/ericmdantas/generator-ng-fullstack/issues/68

ranbuch commented 8 years ago

I've just run: npm install -g generator-ng-fullstack today.

typescript@1.8.9 typings@0.7.9

the angular is not installed globally so the version is yours: "angular2": "^2.0.0-beta.9"

ericmdantas commented 8 years ago

Can you try running typings install in the root of the app? That will install the typings for jasmine, which are related to the errors shown - and should fix this.

ranbuch commented 8 years ago

Yes it did work! Not the only error is: client\dev\todo\components\todo-cmp.ts(3,3): error TS2305: Module '"c:/Users/ranbu/Documents/dev/fitix-selling-point/node_modules/angular2/core"' has no exported member 'View'.

ericmdantas commented 8 years ago

Oh, that's my mistake.

They removed @View. now it's only @Component. You can change that. Everything that's in the view you put in the component. Just remove the View import from angular/core.

ranbuch commented 8 years ago

So in the file client/dev/todo/components/todo-cmp.ts you have this: import { Component, View, Inject, OnInit } from 'angular2/core';

I've turn it to this: import { Component, //View, Inject, OnInit } from 'angular2/core';

and now I have no errors.

How can I run the application? I mean it opens the browser in this URL: http://localhost:3000/ but it loads forever and never returning.

When am I supposed to run 'npm start'?

ericmdantas commented 8 years ago

Just remove the View.

When you run gulp, it'll open an live-reloading server, but your server is not up yet. So, you open another terminal/shell and run npm start.

Then you can refresh the page and all should be working.

ranbuch commented 8 years ago

OK I've run npm start and got this: throw err; ^

SyntaxError: C:/Users/ranbu/Documents/dev/fitix-selling-point/server/api/todo/dao/todo-dao.js: Unexpected token (20:39)

todoSchema.statics.createTodo = (todo) => { return new Promise((resolve, reject) { if (!_.isObject(todo)) return reject(new TypeError('Todo is not a valid object.'));

ranbuch commented 8 years ago

In file server/api/todo/dao/todo-dao.js you have this:

todoSchema.statics.createTodo = (todo) => {
  return new Promise((resolve, reject) {
    if (!_.isObject(todo))
    return reject(new TypeError('Todo is not a valid object.'));

    var _todo = new Todo(todo);

    _todo.save((err, saved) => {
      err ? reject(err)
      : resolve(saved);
    });
  });
}

replace to this:

todoSchema.statics.createTodo = (todo) => {
  return new Promise((resolve, reject) => {
    if (!_.isObject(todo))
    return reject(new TypeError('Todo is not a valid object.'));

    var _todo = new Todo(todo);

    _todo.save((err, saved) => {
      err ? reject(err)
      : resolve(saved);
    });
  });
}

Now I have some other error: An error ocurred with the DB connection: { [MongoError: connect ECONNREFUSED 127.0.0.1:27017] name: 'MongoError', message: 'connect ECONNREFUSED 127.0.0.1:27017' } GET /api/todos/ - - ms - - GET /api/todos/ - - ms - -

Probeblly my bad, my MongoDB isn't running. I'll find a way to fix it.

Thank you so much @ericmdantas !

ericmdantas commented 8 years ago

Thanks for the heads up!

ericmdantas commented 8 years ago

Released 1.6.2 with the fixes.

ericmdantas commented 8 years ago

I'm closing this, since the main issue was resolved, but feel free to let me know if any other errors occur.

ranbuch commented 8 years ago

OK. It's working beautifully on my chrome browser. Not retrieving the data in Edge browser (list always empty). This is another issue and not really effect me . . . FYI. Thanks again.

ericmdantas commented 8 years ago

I'll keep an eye on it, and test on Edge when I get home.

Thanks for the feedbacks!