laravel - "npm run watch"不工作并返回错误 's saying ' 缺少 "Watch"'

标签 laravel npm

在添加 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

Here is the Error Screenshot

最佳答案

更新您的 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/

相关文章:

laravel 检查集合是否包含模型

npm - 禁用 npm "Warning - tslint: error no-string-literal: object access via string literals is disallowed"

npm - 安装 Bower 时出错(ERR!tar.unpack untar 错误)

npm - `npm show @types/react@* version` 的 yarn 当量是多少

database - 获取或获取最新或最后在 laravel 中创建多行

php - 如何在 Laravel 中使用 mysql concat 查询?

php - Laravel 5.1 中带有链接数据库表的 OrderBy

laravel - Laravel 合约到底是什么?

node.js - 带有 NPM 参数的永远命令行

javascript - 具有未封闭 block 的引导依赖性错误