question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

watch doesn't reload server

See original GitHub issue
// index.js
const casual = require('casual')

module.exports = () => {
  const data = { users: [] }
  // Create 1000 users
  for (let i = 0; i < 1000; i++) {
    data.users.push({ id: i, first_name: casual.first_name })
  }
  return data
}

node_modules/.bin/json-server -w index.js

I’d expect my server to reload when index.js is changed. It doesn’t.

What’s the purpose of watch? Or does it only work with json?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
corysimmonscommented, Jul 12, 2019

Just noticed people are still having problems with this.

You can always bypass specific lib’s non-reloading watchers by doing something like

{
  "scripts": {
    "dev": "nodemon -w some-dir -x node server.js" // watch some directory, when something changes, eXecute `$ node server.js`
  },
  "devDependencies": {
    "nodemon": "latest"
  }
}

You’ll encounter 50,000 libraries that do this wrong. Get cozy with a workaround like nodemon -x.

2reactions
busticommented, Jun 25, 2019

This problem still persists today. Will this ever be fixed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack --watch doesn't reload on code changes
I am building react API based application. Backend framework is PHP symfony and I used latest react with webpack.
Read more >
Solution for Webpack 5 Dev Server Not Live Reloading
0:00 · New! Watch ads now so you can enjoy fewer interruptions. Got it.
Read more >
Hot Module Replacement | Laravel Mix Documentation
Hot Module Replacement (or Hot Reloading) allows you to, not just refresh the page ... From the command line, run npm run hot...
Read more >
vue components doesn't update on shared hosting server
what i'm doing right now is editing the components in my local server, run "npm run watch" and then uploading these two files...
Read more >
Problem: Live reloading isn't refreshing for Webpack 5
As I was setting up my webpack-dev-server for some reason it wasn't actually reloading. Turns out you have to set a target!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found