简体   繁体   English

与WAMP的NPM浏览器同步不起作用

[英]npm browser-sync with wamp is not working

I am developing a Codeigniter project using Sublime Text 3 as editor and wamp as a local server - OS Windows 10. It all works fine but I want to find a way to get the browser to refresh when I save a file. 我正在开发一个使用Sublime Text 3作为编辑器并将wamp作为本地服务器-OS Windows 10的Codeigniter项目。一切正常,但是我想找到一种方法来保存文件时刷新浏览器。 I installed BrowserRefresh in ST3 but it doesn't work. 我在ST3中安装了BrowserRefresh,但是它不起作用。 I suspect his might be because it is designed for html files rather than the Codeigniter php structure and inbuilt security. 我怀疑他可能是因为它是为html文件而不是Codeigniter php结构和内置安全性设计的。 So I installed npm browser-sync (successfully). 因此,我成功安装了npm browser-sync。 When I cd to the project folder and start browser-sync using the following in the command line: 当我CD到项目文件夹并在命令行中使用以下命令启动浏览器同步时:

browser-sync start --server --files "index.php"

I get the right response: 我得到正确的回应:

[Browsersync] Access URLs:
 --------------------------------------
       Local: http://localhost:3001
    External: http://192.168.1.121:3001
 --------------------------------------
          UI: http://localhost:3002
 UI External: http://192.168.1.121:3002
 --------------------------------------
[Browsersync] Serving files from: ./
[Browsersync] Watching files...

but in the browser at localhost:3001 I see the response 但是在浏览器中localhost:3001上我看到了响应

Cannot GET /

I'm not an experienced command line user and clearly doing something wrong. 我不是经验丰富的命令行用户,显然做错了什么。 I have read something about gulp.js while researching but I know nothing about this and everything I read was completely inexplicable. 我在研究时已经阅读了有关gulp.js的内容,但对此一无所知,而且我读到的所有内容都是完全无法解释的。 If I need to use it I will need a step by step tutorial and would welcome any advice. 如果需要使用它,我将需要一个分步教程,并欢迎您提出任何建议。

Thanks for your interest Brad but, as I said in the post, I tried BrowserRefresh and it didn't work. 感谢您对Brad的关注,但是,正如我在帖子中所说的那样,我尝试使用BrowserRefresh却无法正常工作。 However, I've just come across LiveReload which I'm happy to say works perfectly 但是,我刚刚遇到了LiveReload,我很高兴地说它可以完美地运行

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

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