Laravel - npm run watch - runs repeatedly - nonstop

Viewed 6413

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!

4 Answers

i had same issue and it's because i placed my image into public/images directory and this path was loading into my sass file. when i changed image path , that's worked fine

This issue happen's when you placed your assets into build path.

This issue seems like it can have multiple error sources. In my case I it was relevant to Tailwind CSS and the purge option. I don't remember exactly what package I have installed but I copy pasted the following to my tailwind.config.js:

module.exports = {
    mode: 'jit',
    purge: {
        content: [
            './public/**/*.html',

After I have removed the line './public/**/*.html', it worked.

Related