Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working #36

Open
Monster0303 opened this issue Jul 9, 2019 · 6 comments
Open

Not working #36

Monster0303 opened this issue Jul 9, 2019 · 6 comments

Comments

@Monster0303
Copy link

Hello
I use the hexo3.9 mist theme
I installed and started this way.

Npm install -g browser-sync
Npm install hexo-browsersync --save
Hexo server

But nothing happened
What should I do?

@85Ryan
Copy link

85Ryan commented Jul 15, 2019

same issue, Browsersync not working....

"hexo": "^3.9.0",
"hexo-browsersync": "^0.3.0"

@Monster0303
Copy link
Author

Try to reproduce
Currently found:

  1. When the blog's home page is saved, saving the markdown file will be refreshed. This is useless because the home page can only be refreshed.
  2. (Occasionally) On the article page, after a few minutes, the real-time refresh function will work normally.

Can't find the law completely

@qianbinbin
Copy link

Same issue here, not every time but the probability is high.
When opening any other pages the browser shows Browsersync: connected, except the page not published yet.

"hexo": "^4.2.0",
"hexo-browsersync": "^0.3.0",

@sukrosono
Copy link

I had the same issues, the state is. it's hard to tell why.

for me, i am expecting changes when editing some css or sass file, but it's not!!!

@qianbinbin
Copy link

I had switched to hugo, with this feature builtin.

@tamtam180
Copy link

I investigated this issue.

hexo-browsersync is using connect-injector to insert a snippet into the response. In particular, it searches for and inserts the code for reload just before it. However, the content of the converter function is missing the end. Therefore, the is not found and the code for Reload is not inserted.

About connect-injector.
The write function receives the chunk and writes it to the WritableStreamBuffer of the node-stream-buffer. At this time, the chunk is complete HTML and there is no missing data.
However, after the chunk is written to WritableStreamBuffer, it is missing. This seems to be a bug in node-stream-buffer.

The version of node-stream-buffer used by connect-injector is 0.2.3, which is very old. As a work-around, set it to 0.2.6 and it will work. If you increase the version too much, it will stop working.

node_modules/
  connect-injector/
    package.json
      : "stream-buffers": "^0.2.3" -> "stream-buffers": "^0.2.6"
$ npm install

after then,

node_modules/
  connect-injector/
    node_modules/
      stream-buffers # version 0.2.6

In the future, I think it would be better to use something else since connect-injector is an old library.

Another solution

Use the browse-sync proxy.

npm install -g browser-sync
browser-sync start --proxy localhost:4000 --files *

After then, access to http://localhost:3000/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants