Home > OS >  Laravel/NodeJS - npm ERR! Missing script: "watch"
Laravel/NodeJS - npm ERR! Missing script: "watch"

Time:08-31

I've upgraded to Laravel 9 recently.

Here is my package.json:

{
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "vite build"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^3.0.3",
    "autoprefixer": "^10.4.8",
    "axios": "^0.21",
    "laravel-mix": "^6.0.6",
    "laravel-vite-plugin": "^0.6.0",
    "lodash": "^4.17.19",
    "postcss": "^8.4.16",
    "tailwindcss": "^3.1.8",
    "vite": "^3.0.9"
  },
  "dependencies": {
    "alpinejs": "^3.8.1",
    "laravel-echo": "^1.11.3",
    "pusher-js": "^7.0.3"
  },
  "name": "beastburst-website",
  "description": "<p align=\"center\"><a href=\"https://laravel.com\" target=\"_blank\"><img src=\"https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5 SVG/2 CMYK/1 Full Color/laravel-logolockup-cmyk-red.svg\" width=\"400\"></a></p>",
  "version": "1.0.0",
  "main": "tailwind.config.js",
  "directories": {
    "test": "tests"
  },
  "repository": {
    "type": "git",
    "url": "https://code.scarsgaming.net/BeastBurst/BeastBurst-Website.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

When I run npm run watch I get the following error:

npm ERR! Missing script: "watch"
npm ERR! 
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/venelin/.npm/_logs/2022-08-31T11_40_11_910Z-debug-0.log

Any idea why and how can I fix that?

CodePudding user response:

The default bundler for Laravel now is Vite as you can clearly see from your package.json

If you do not want to use Vite, use this guide to switch to mix

I should also mention that Vite is much faster that mix.

CodePudding user response:

try npm run dev it will work like npm run watch that is because Laravel 9 now uses Vite.

  • Related