繁体   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