`npm run watch` not working in Laravel 5.4

家住魔仙堡 提交于 2019-11-29 06:00:19

问题


Using Laravel 5.4 and Mix, when I run npm run watch it compiles everything once and looks like it is waiting for changes, but when I make changes to any of my asset files it doesn't seem to detect anything. Is anyone else having this issue in 5.4 or have a solution?


回答1:


The solution was provided by Jeffrey Way over at Laracasts.

Try adding the --watch-poll flag to your package.json script. Or just try:

node_modules/.bin/webpack --watch --watch-poll --config=node_modules/laravel-mix/setup/webpack.config.js




回答2:


npm run watch-poll

It's working on ubuntu as well And auto compiling on code changes. Thank you.




回答3:


npm run watch-poll

watch-poll periodically checks (polls) for changes e.g. every 1000ms it will manually check to see if any files have changed.

what laravel docs say?

You may find that in certain environments Webpack isn't updating when your files change. If this is the case on your system, consider using the watch-poll command. You can read up on the docs for a more information about mix.



来源:https://stackoverflow.com/questions/41866944/npm-run-watch-not-working-in-laravel-5-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!