[nodemon] app crashed - waiting for file changes before starting...

1,613 views
Skip to first unread message

Bram De

unread,
Jan 18, 2016, 10:34:06 AM1/18/16
to MEAN.JS
I changed these lines of code:

exports.read = function (req, res) {
  res
.json(req.external);
};

Into: 

exports.read = function (req, res) {
 
//res.json(req.external);
  console
.log(req.external);
  console
.log('start----------');
 
External.findById(req.external._id)
   
.populate('user', 'displayName')
   
.populate('articles')
   
.exec(function (err, external) {
      console
.log('in execution mode');
     
if (err) {
        console
.log('ERROR ERROR ERROR');
       
return res.status(400).send({
          message
: errorHandler.getErrorMessage(err)
       
});
     
} else {
        console
.log('There is no error generated!');
        res
.json(external);
     
}
   
});
};

Everything was working fine before I added these lines of codes.
The strange thing I find is that it doesn't get into an error!
It crashes after a while when I start doing other requests to the backend.
(The other request weren't a probelm before adding these lines of code)

Anyone has an idea? 

Bram De

unread,
Jan 18, 2016, 10:42:31 AM1/18/16
to MEAN.JS
This is what I get as a response back which is correct! 
But right after this the app crashes.
I'd really appreciate any help!


{
  "_id": "5698e24ad25672881fea7ddd",
  "user": {
    "_id": "568b9d35250441ac2f3cdf14",
    "displayName": "test"
  },
  "typeContract": "offer",
  "__v": 0,
  "VAT": "BE64646",
  "processed": 2,
  "extraInfo": "test",
  "selfService": false,
  "postalDelivery": "10",
  "cityDelivery": "NY",
  "addressDelivery": "teststreet",
  "shelves": "no",
  "end": "2016-05-21T22:00:00.000Z",
  "start": "2016-05-21T22:00:00.000Z",
  "articles": [
    {
      "_id": "56957753e3c2210e00d2d965",
      "user": "568b9d35250441ac2f3cdf14",
      "__v": 0,
      "unitPrice": "165",
      "description": "test",
      "code": "test",
      "id": "",
      "created": "2016-01-12T21:59:47.213Z"
    },
    {
      "_id": "5695778de3c2210e00d2d966",
      "user": "568b9d35250441ac2f3cdf14",
      "__v": 0,
      "unitPrice": "210",
      "description": "test",
      "code": "test",
      "id": "",
      "created": "2016-01-12T22:00:45.608Z"
    }
  ],
  "created": "2016-01-15T12:12:58.371Z"
}

Op maandag 18 januari 2016 16:34:06 UTC+1 schreef Bram De:

Abraham Kalu Ume

unread,
Apr 5, 2018, 10:23:15 AM4/5/18
to MEAN.JS
I encountered this challenge when working on nexmo sms app.

To fix the crashing, go to your
`app.js`

. If you have these lines of code. Its normally on the very first lines...

   `import { Socket } from 'dgram';`
   
   `const express = require('express');`
   `const bodyParser = require('body-parser');`
   `const ejs = require('ejs');`
   `const Nexmo = require('nexmo');`
   `const socketio = require('socket.io');`


    


Simply delete/remove the first line of code 
`import { Socket } from 'dgram';`

Leaving these ones...

       `const express = require('express');`
       `const bodyParser = require('body-parser');`
       `const ejs = require('ejs');`
       `const Nexmo = require('nexmo');`
       `const socketio = require('socket.io');`


       and restart your application using "nodemon"

Did it work?
Reply all
Reply to author
Forward
0 new messages