Laravel/NodeJS - npm ERR!缺少脚本:"watch"



我最近升级到了Laravel 9。

这是我的包.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,您可以从您的包.json 中清楚地看到这一点

如果您不想使用Vite,请使用本指南切换到混合

我还应该提到的是,Vite的速度要快得多。

尝试npm run dev,它将像npm run watch一样工作,这是因为Laravel 9现在使用Vite。

最新更新