简体   繁体   中英

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

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%20SVG/2%20CMYK/1%20Full%20Color/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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM