简体   繁体   English

如何通过命令提示符同时使用 npm run watch 和 php artisan serve?

[英]How to use npm run watch and php artisan serve together through the command prompt?

I enter npm run watch first and then then I can't enter php artisan serve .我先输入npm run watch再输入php artisan serve Is there a way I can use them in the same command?有没有办法可以在同一个命令中使用它们?

Thanks谢谢

打开两个终端并在其中输入 npm run watch ,准备就绪后在另一个终端中运行 php artisan 。

If this helps anyone, npm run hot works correctly with Laravel 8 and Vue 2. I'm using built-in Vue scaffolding of Laravel UI (and not a separate Vue CLI project).如果这对任何人都有帮助, npm run hot可以在 Laravel 8 和 Vue 2 中正常工作。我使用的是 Laravel UI 的内置 Vue 脚手架(而不是单独的 Vue CLI 项目)。

Just use php artisan serve to serve your Laravel application and then open a new terminal window and run npm run hot .只需使用php artisan serve为您的 Laravel 应用程序php artisan serve服务,然后打开一个新的终端窗口并运行npm run hot Now the browser output will update automatically when you make changes to your Vue components.现在,当您对 Vue 组件进行更改时,浏览器输出将自动更新。

Make sure your webpack.mix.js contains the .vue() call in its chain.确保您的webpack.mix.js在其链中包含.vue()调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM