title: How to watch for changes to files in a folder using npm?
body: <p>I'm trying to set up some form of auto-deployment using the npm package watch. Here is my package.json file:</p>
  
  <pre><code>{
    "name": "frontend",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "dev": "next",
      "build": "next build",
      "start": "next start -p 60000",
      "watch:start": "watch \"npm run start\" ./build"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        ...
    },
    "devDependencies": {
      "watch": "^1.0.2"
    }
  }
  </code></pre>
  
  <p>The app runs fine and it watches the correct folder, but when it detects a change, I get an infinite loop of EADDIRINUSE errors, because it is simply trying to re-run the app, not restart it.</p>
  
  <p>How can I fix this?</p>