guanacone / fullstack_app

BSD Zero Clause License
0 stars 0 forks source link

nodemon #13

Closed guanacone closed 3 years ago

guanacone commented 4 years ago

Could you please orientate me on how to solve the nodemon issue? When gatsby develop I get:

...
exports.createUser = async (req, res) => {
  try {
    const newUser = await new User({
      firstName: req.body.firstName,
      familyName: req.body.familyName,
    })
      .save();
    res
      .status(201)
      .json(newUser);
  } catch(err) {
    res
      .status(400)
      .json(err);
  }
};

But server works fine. Getting same error when applying changes to the backend but works fine after manual restart.

edwmurph commented 4 years ago

did you mean to copy/paste that particular snippet for this? also which branch are you seeing this error on?

guanacone commented 4 years ago

I'm running it on database branch. Wrong copy/past... This is actually what I ment to quote:

$ gatsby develop
Debugger listening on ws://127.0.0.1:9229/c8363172-9ecf-413c-b8c0-58120aac9902
For help, see: https://nodejs.org/en/docs/inspector
success open and validate gatsby-configs - 0.024s
success load plugins - 0.059s
[custom server] Starting the custom Node.js server for the buildtime...
[custom server] listening on port 1337

success onPreInit - 0.329s
success initialize cache - 0.004s
success copy gatsby files - 0.030s
success onPreBootstrap - 0.013s
success createSchemaCustomization - 0.006s
success Checking for changed pages - 0.003s
success source and transform nodes - 0.030s
success building schema - 0.134s
success createPages - 0.002s
success Checking for changed pages - 0.002s
success createPagesStatefully - 0.043s
success update schema - 0.023s
success write out redirect data - 0.003s
[custom server] Starting the custom server in watch mode using nodemon...
[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,json,ts
[nodemon] starting `node server/index.js --no-gatsby`
success onPostBootstrap - 0.039s
info bootstrap finished - 2.490s
success onPreExtractQueries - 0.002s
success extract queries from components - 0.102s
success write out requires - 0.010s
success run page queries - 0.028s - 2/2 72.70/s
[nodemon] app crashed - waiting for file changes before starting...
⠀
You can now view fullstack_app in the browser.
⠀
  http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
  http://localhost:8000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use gatsby build
⠀
success Building development bundle - 2.625s
success onPreExtractQueries - 0.005s
success extract queries from components - 0.035s
success write out requires - 0.001s
edwmurph commented 4 years ago

i dont see that error, i'd recommend trying the following steps to reset your dev env:

git checkout database
git pull
rm -rf node_modules
nvm use
npm install
npm run develop
this is what i see: ``` 5s 2:08:37 ~/code/mentorships/fullstack_app⟩ nr develop ± ● database > fullstack_app@0.1.0 develop /Users/emurphy/code/mentorships/fullstack_app > gatsby develop -p 8001 success open and validate gatsby-configs - 0.087s success load plugins - 1.755s [custom server] Starting the custom Node.js server for the buildtime... [custom server] listening on port 1337 success onPreInit - 4.071s success initialize cache - 0.006s success copy gatsby files - 3.087s success onPreBootstrap - 0.083s success createSchemaCustomization - 0.005s success Checking for changed pages - 0.003s success source and transform nodes - 0.033s success building schema - 0.212s success createPages - 0.005s success Checking for changed pages - 0.002s success createPagesStatefully - 0.103s success update schema - 0.030s success write out redirect data - 0.023s [custom server] Starting the custom server in watch mode using nodemon... [nodemon] 2.0.4 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,json,ts [nodemon] starting `node server/index.js --no-gatsby` success onPostBootstrap - 0.109s info bootstrap finished - 38.697s success onPreExtractQueries - 0.004s success extract queries from components - 0.275s success write out requires - 0.067s success run page queries - 0.055s - 2/2 36.30/s [custom server] listening on port 1337 ⠀ You can now view fullstack_app in the browser. ⠀ http://localhost:8001/ ⠀ View GraphiQL, an in-browser IDE, to explore your site's data and schema ⠀ http://localhost:8001/___graphql ⠀ Note that the development build is not optimized. To create a production build, use gatsby build ⠀ success Building development bundle - 11.370s ```

if the above steps dont work, i can help you debug it in person in our next meeting

guanacone commented 4 years ago

Still getting the same message. scheduled a call for tomorrow.