angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.13k stars 1.24k forks source link

grunt serve:debug command is not working #2332

Open charliemc opened 7 years ago

charliemc commented 7 years ago
Item Version
generator-angular-fullstack 3.3.0
Node 4.4.0
npm 3.8.1
Operating System macOS Sierra 10.12.1
Item Answer
DB MongoDB

I'm having issues when trying to debug my app using the grunt serve:debug command. Initially, everything loads and node-inspector starts correctly stopping by default at the initial break-point.

Seconds after resuming the script execution, I get the following error on screen:

MongoDB connection error: MongoError: failed to connect to server [localhost:27017] on first connect
[nodemon] app crashed - waiting for file changes before starting...

captura de pantalla 2016-10-30 a las 20 12 07

It seems I am not being able to debug using grunt serve:debug, does anyone guess or know what could be causing this?

As additional information I have to say that everything else, other grunt tasks, such as grunt serve, grunt test:server have always worked fine. MongoDB is set up correctly and also works fine too.

RonAlmog commented 7 years ago

From what i can clearly see in your console, mongodb is not available. please check that. does it run fine when you are not in debug mode? check your connection string. OR, install Robomongo, and try to connect to your database and make sure it's up and running. Another thing, if you haven't done that already, set your mongodb to run as a service, so you don't have to run in manually every time. that will save you from most of these issues.

charliemc commented 7 years ago

Hi @RonAlmog !

MongoDB is working fine, and I already use Robomongo and everything is working correctly. That's why I'm very confused at this point. Thank you for your response anyway!

Awk34 commented 7 years ago

@charliemc Ron is right. The application can't connect to your local mongo daemon. You need to be running the mongo daemon locally on the default port.

charliemc commented 7 years ago

@Awk34 my mongo daemon is always running, and also running on the default port. In fact, I've been developing and working on this particular project that was generated from this generator for months now and never had any problems with mongo before. It's just when running grunt serve:debug.

There you have a screenshot, so you can see:

captura de pantalla 2016-11-03 a las 0 42 48

On the left, mongo daemon running on default port, on the right grunt serve:debug's crash.

thedewpoint commented 7 years ago

@charliemc Did you have any luck fixing this? Just ran into this issue today.

charliemc commented 7 years ago

Hi @thedewpoint, I sadly didn't... I've tried to run this command from different machines and haven't been able to make it work.

Awk34 commented 7 years ago

If you run grunt serve, everything works though? I find this all rather odd. Have you tried with a freshly-scaffolded application as well? (no modifications). You might also try using the latest version of the generator.

thedewpoint commented 7 years ago

I have a relatively new version, maybe only a few months old. Running gulp serve regularly works perfect. Serve:debug starts up and then when it goes to seed my db it can't connect. I've tried connecting to a remote mongodb as well, and I've also tried different versions of mongo.

On Nov 11, 2016 9:22 AM, "Andrew Koroluk" notifications@github.com wrote:

If you run grunt serve, everything works though? I find this all rather odd. Have you tried with a freshly-scaffolded application as well? (no modifications). You might also try using the latest version of the generator.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular-fullstack/generator-angular-fullstack/issues/2332#issuecomment-259967042, or mute the thread https://github.com/notifications/unsubscribe-auth/ADEBQ-7vswN0eI1UtOgQQPhKOCrbA5rnks5q9HoKgaJpZM4Kkd2w .

Awk34 commented 7 years ago

@thedewpoint are you also on a Mac? Which MongoDB version are you running?

thedewpoint commented 7 years ago

I'm not at home now but it's windows 8 PC , not positive on the mongo version but it's 2.x on my windows local, and my remote mongodb was running on debian Linux and was 3.x neither worked

On Nov 11, 2016 9:32 AM, "Andrew Koroluk" notifications@github.com wrote:

@thedewpoint https://github.com/thedewpoint are you also on a Mac? Which MongoDB version are you running?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular-fullstack/generator-angular-fullstack/issues/2332#issuecomment-259969066, or mute the thread https://github.com/notifications/unsubscribe-auth/ADEBQ6gYbydH5NnkuRgSdk5zYSLkEKWLks5q9HxfgaJpZM4Kkd2w .

charliemc commented 7 years ago

@Awk34 yes, if I run grunt serve everything works perfectly. I'm about to start a new project based on this generator, I will try this command again on this new application and will let you know.

thedewpoint commented 7 years ago

Weird thing. I downloaded my project on my mac laptop and it works there. Maybe this is a windows specific issue?

On Fri, Nov 11, 2016 at 10:37 AM, Charlie Martínez <notifications@github.com

wrote:

@Awk34 https://github.com/Awk34 yes, if I run grunt serve everything works perfectly. I'm about to start a new project based on this generator, I will try this command again on this new application and will let you know.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular-fullstack/generator-angular-fullstack/issues/2332#issuecomment-259983831, or mute the thread https://github.com/notifications/unsubscribe-auth/ADEBQ4MSJysF3aB_P5i1QAGN3Pqc_RRqks5q9IvBgaJpZM4Kkd2w .

albert-92 commented 7 years ago

I got the same error on Windows 7 and generator-angular-fullstack 4.1.0

[nodemon] starting `node --debug=5858 --debug-brk server`
Debugger listening on port 5858
 (node) crypto.createCredentials is deprecated. Use tls.createSecureContext instead.
(node) crypto.Credentials is deprecated. Use tls.createSecureContext instead.
MongoDB connection error: MongoError: failed to connect to server [localhost:27017] on first connect
[nodemon] app crashed - waiting for file changes before starting...
albert-92 commented 7 years ago

Just tested it on Windows 10 and Ubuntu 16.04 both with node 6.3.1, MongoDB 3.4.0 and a clean generator-angular-fullstack 4.1.0.

Same problem on both systems:

MongoDB connection error: MongoError: failed to connect to server [localhost:27017] on first connect [nodemon] app crashed - waiting for file changes before starting...

woyehenni commented 7 years ago

Mac have the same problem.

woyehenni commented 7 years ago

worked by modify gulpfile.babel.js. // nodemon(-w ${serverPath} --debug=5858 --debug-brk ${serverPath}) nodemon(-w ${serverPath} --debug=5858 ${serverPath}) but i don't know why this happened.

Awk34 commented 7 years ago

If you're using a newer version of Node (>= 6.3.0 I think), you can just use the --inpsect command: https://nodejs.org/api/debugger.html#debugger_v8_inspector_integration_for_node_js

guipsamora commented 7 years ago

I've been constantly running to this issue and I have to restart node using "rs" at least 3 to 4 times, which is making my development pace very slow.

@woyehenni I've tried what you did but it hasn't worked for me, any other tip or tweaks to make this work on mac?

Thanks on any input/suggestion

screen shot 2017-02-12 at 9 53 50 pm