M-Zuber/npm-watch

Not working on mac OS

mattiaocchiuto opened this issue · 19 comments

Hello, I'm trying to use it on a mac but the script is not triggering the command when the watched files are modified. (I've tested the same configuration on a Ubuntu OS and is working correctly).

This is my configuration:

  "watch": {
    "compile-less": {
      "patterns": ["src/*"],
      "extensions": "less"
    }
  },
  "scripts": {
    "compile-less:watch": "npm-watch"
  }

I have the same issue. :(

{
  "watch": {
    "icons": "./img/icons/*.svg"
  },
  "scripts": {
    "icons": "svg-sprite --symbol --dest=./img --symbol-dest=. --symbol-sprite=icons.svg ./img/icons/*.svg",
    "watch": "npm-watch"
  }
}

First off, apologies for the late reply.

Second, a slight problem is that I do not have (easy) access to a mac, but at the moment we can still try and do some detective work.

  1. Is there a previous version that does work on mac os?
  2. what node version is being used?

I'm on a mac and it works.

Broken for me on both OSX and Windows, version details...

  • OSX 10.12.3 (Sierra) and Windows 10 Pro (v1607)
  • Node v6.10.0 (LTS version)
  • npm-watch 0.1.8

Behaviour:

  • npm-watch does start up and run all the tasks once, they report clean exits
  • pug-cli and node-sass tasks are not re-run for file add/delete/change
  • uglify-js and shx commands ARE re-run for file add/change but NOT for delete

definitely not working on Mac OS. Says it can't find the watch script

@matkovsky try

"watch": "npm-watch icons"

Been doing a bad job of keeping on top of issues here, my apologies.
Can any of you who where still having issues try to manually switch nodemon to the latest version and let me know of that fixes anything?

I'm on macos sierra, Node 8.1.3, npm 5.1.0, nodemon 1.11.0 (manually the latest version, but also the version as in npm-watch 0.2.0) and watching works for me sometimes. I can run several times and sometimes it will display

[experiment] [nodemon] watching: {src,test}/*.js

and watching will work then, but sometimes nothing is shown.

Maybe not the same issue but npm-watch recently stopped triggering on file changes on my Mac as well.

It started happening around the time we added a small node server and installed nodemon to run it. We were previously just using the brunch dev server. I've tried various versions of nodemon with no luck; thinking there was some conflict there.

Anyone else still having this issue?

It is working fine for me...sorry
OSX: 10.13.6
Node: v10.12.0
npm-watch: 0.4.0

my package.json

"scripts": {
    "electron": "electron .",
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npm-watch electron"
  },
  "watch": {
    "start": "src/index.js",
    "electron": "src/*.js"
  },

Hey,

I found that it's not working on MacOS if you're running npm run watch from the Terminal of a virtual machine (in my case the Laravel Homestead Vagrant box).
When I run npm run watch from my Mac Terminal, it works.

Hope it helps.

I found I had to use the fuller watch like below for it to work for me:

"watch": {
"start": {
  "patterns": [
    "source"
  ],
  "extensions": "ts",
},

Something like the following would not work:

"local-start": "source/**/*.ts"

Further to this, I was getting EADDRINUSE errors every second or so restarts. I'm not sure what caused it. However I found that for my purposes, nodemon worked. It's unfortunately not as flexible with possible (separate) configurations as npm-watch.

Unfortunately i dont think this works with mac os

"script":{
"watch:introspect": "npm-watch introspect",
  },
  "watch": {
    "introspect": "graphql/**/*.graphql"
  },
czebe commented

We're having the same issue.

These don't work (they trigger the compilation on startup, but fail to kick in on changes to any of the files):

"compile-css": "*.less"
"compile-css": "./src/**/*.less"
"compile-css": "src/**/*.less"

This watch config on the other hand works as expected:

"compile-css": {
  "patterns": ["src"],
  "extensions": "less"
 }

Hi @M-Zuber
I just made a PR which fixes this issue
Thank you for this lib, it's very useful

npm-watch 0.6.0
node 10.16.0
macOS 10.14.5
VSCode Terminal

Still can't get it work with an inline glob pattern. eg: "foo": "./src/*.html"

But it's ok since I found that I can use the full-option way according to czebe's comment above.

This is an old issue, and it seems that the issue across the board was watching scripts with a non-default (per nodemon's defaults)extension.

If anyone is still having an issue after using the expanded config, please open a new issue.