在添加 tailwind 模板后的新 laravel 项目中,我尝试运行 npm run watch
但它不起作用,因此模板也没有正确加载。
$ 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! C:\Users\U-S-E-R\AppData\Local\npm-cache\_logs\2022-07-27T18_05_36_192Z-debug-0.log
最佳答案
更新您的 package.json 文件。
...
"scripts": {
"dev": "vite",
"build": "vite build",
"watch": "vite build --watch"
},
...
引用:https://vitejs.dev/guide/build.html#rebuild-on-files-changes https://laracasts.com/discuss/channels/vite/equivalent-of-vite-watch?reply=809106
现在试试运行
npm run dev
npm run watch
关于laravel - "npm run watch"不工作并返回错误 's saying ' 缺少 "Watch"',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73142864/