3

Thanks in advance for helping me.

I want to create a product build on changes inside src directory. For that I used watch package of npm. Below is my "scripts" inside package.json

"scripts": {
    "webpack-dev-server": "webpack-dev-server",
    "dev": "watch 'npm run prod' src",
    "prod": "webpack --mode=production"
},

Now when I run npm run dev command. It gives me:

Error: ENOENT: no such file or directory, stat 'E:\projects\chatapp\run'

2 Answers2

9

If you are using Windows, you have to use " instead of ' in dev command:

"dev": "watch \"npm run prod\" src"

It is also mentioned in github.com/mikeal/watch#examples:

Note: Because Windows users may need to use double quotes rather than single quotes they need to escape the them in npm scripts

Ugnius Malūkas
  • 2,649
  • 7
  • 29
  • 42
0

Try with npm install maybe it solves or you can look at this thread as it seems similar issue How to resolve Nodejs: Error: ENOENT: no such file or directory and more specifically to this answer https://stackoverflow.com/a/43260706/10928899

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Besart Marku
  • 543
  • 1
  • 7
  • 14
  • I tried by `npm install` and also tried to create prod and run folder. But not worked. –  Apr 18 '19 at 07:51