Laravel - npm run watch - runs repeatedly - nonstop

laravel, npm

Solution

The proper answer to this issue was addressed here

https://github.com/JeffreyWay/laravel-mix/issues/228

It also has solution to resolve it and what causes it.

Problem

I have installed Laravel. I use the Visual Studio Code to develop on my Windows 10. I have installed the npm and node. And ran install based on Laravel's default `package.json`, using `npm install` command. I kept the file unchanged, and it looks like this: ``` { "private": true, "scripts": { "dev": "npm run development", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch-poll": "npm run watch -- --watch-poll", "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "npm run production", "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { "axios": "^0.15.3", "bootstrap-sass": "^3.3.7", "cross-env": "^3.2.3", "jquery": "^3.1.1", "laravel-mix": "0.*", "lodash": "^4.17.4", "vue": "^2.1.10" } } ``` The problem is, that running `npm run watch`, does not just make the npm wait for changes. npm runs the `npm run dev` all the time, over and over again!

Original source