簡體   English   中英

Laravel/NodeJS - npm ERR:缺少腳本:“watch”

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

我最近升級到 Laravel 9。

這是我的 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"
}

當我運行npm run watch時,我收到以下錯誤:

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

知道為什么以及如何解決這個問題嗎?

Laravel 的默認捆綁器現在是 Vite,您可以從 package.json 清楚地看到

如果不想使用 Vite,請使用本指南切換到混音

我還應該提到, Vite的混合速度要快得多。

嘗試npm run dev它將像npm run watch一樣工作,這是因為 Laravel 9 現在使用 Vite。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM