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

"LiveReload disabled because it could not find its own <SCRIPT> tag" after a handful of saves #195

Closed
IBwWG opened this issue Jan 5, 2017 · 14 comments
Labels

Comments

@IBwWG
Copy link

IBwWG commented Jan 5, 2017

That's what the console says when I load /. My setup:

budo --live --open index.js
win7x64sp1
nodejs 7.3.0

@IBwWG
Copy link
Author

IBwWG commented Jan 5, 2017

Um, OK, the first few force-reloads didn't fix this, and now, it somehow fixed itself. Never mind, sorry for the bother...

@IBwWG IBwWG closed this as completed Jan 5, 2017
@IBwWG
Copy link
Author

IBwWG commented Jan 5, 2017

Er...it's very intermittent. I'll make several changes to a file, and each save triggers a reload OK, and then suddenly a save will cause that error and no further live reloading will happen until I can get the browser to reload the page from scratch.

@IBwWG IBwWG reopened this Jan 5, 2017
@IBwWG
Copy link
Author

IBwWG commented Jan 5, 2017

Sometimes, that "getting the browser to reload the page from scratch" takes up to 6 "shift+clicking the reload icon". Firefox 50.1.0.

@IBwWG IBwWG changed the title "LiveReload disabled because it could not find its own <SCRIPT> tag" "LiveReload disabled because it could not find its own <SCRIPT> tag" after a handful of saves Jan 5, 2017
@IBwWG
Copy link
Author

IBwWG commented Jan 5, 2017

Really strange. I'm just adding a character to a string, to test this. The past three runs took 3, then 2, then 5 saves before this issue happened.

@mattdesl
Copy link
Owner

mattdesl commented Jan 5, 2017

Thanks for testing — so basically it's just not very reliable for you on Windows?

Can you try this script to let me know what events are firing for you?

dev.js

require('budo').cli(process.argv.slice(2), {
  live: true
}).on('watch', function (ev, file) {
  console.log('file changed', file);
}).on('update', function () {
  console.log('new bundle');
});

Save it as dev.js and then, instead of running budo, use:

node dev.js index.js

When you save the index.js file it shoould say "new bundle" and when you save a CSS or HTML file in the same directory it should say "file changed" with the path. If the terminal isn't printing those, it means Chokidar (file watching) is the problem. If the terminal is reliably printing that, but the page isn't reloading reliably, it means tiny-lr (LiveReload) is the problem.

I've been planning on overhauling the LiveReload backend at some point (#194) which may alleviate some of this (it works pretty well for me on OSX but I have heard complaints on other platforms).

@IBwWG
Copy link
Author

IBwWG commented Jan 6, 2017

Thanks for your help! Unfortunately when I do the above, I get the error Cannot find module 'budo' even though I installed it globally with npm. The budo command does work on the command line though. I was using it in this context: https://github.com/lhorie/mithril.js/blob/rewrite/docs/installation.md#live-reload-development-environment (which uses the command-line rather than inclusion in a js script)

@mattdesl
Copy link
Owner

mattdesl commented Jan 6, 2017

Ah — for the above script to work you will need to install it locally npm install budo. You don't need to save it to your package.json as long as you install it in a directory that has a package.json. The script is just to test to see where the problem is (live reload vs chokidar).

I've made some progress on the live reload backend, you can also test it like this:

npm install mattdesl/budo#feature/livereload-rework -g

@IBwWG
Copy link
Author

IBwWG commented Jan 7, 2017

OK, making progress, but now budo serves up a page saying,
"Cannot find module 'fsevents'
myproj\node_modules\chokidar\lib"

That fsevents gets a warning really often using npm, but it always says 'optional'. I'm on Windows at this particular moment but IIRC I also get it on Linux Mint. Makes sense now that I look at the warning more closely, since neither are Darwin:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\ch
okidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"
})

(I got that installing budo, but no other warnings or errors)

@IBwWG
Copy link
Author

IBwWG commented Jan 7, 2017

This is also true if I revert the install back from the feature branch.

@mattdesl
Copy link
Owner

mattdesl commented Jan 12, 2017

Ok, I've tested the LiveReload branch on my Windows 10 with node 6.9.4 and fixed a couple small issues, seems to be working alright now. Hopefully the latest version will work for you:

npm install mattdesl/budo#feature/livereload-rework -g

(Or, if you are running budo in a package.json "scripts" field, make sure to save it locally with --save or --save-dev)

@mattdesl mattdesl added the bug label Jan 12, 2017
@IBwWG
Copy link
Author

IBwWG commented Jan 14, 2017

That seems to work great, I made about 20 changes, and every one of them worked. Thanks!

@IBwWG
Copy link
Author

IBwWG commented Jan 14, 2017

(I would close but I guess you want to leave it open until you merge the branch, etc.)

@clementoriol
Copy link

I'm actually having the same issue on MacOSX 10.11.6 (El Capitan), if it can helps.
Using the livereload-rework branch fixes it.

@mattdesl
Copy link
Owner

This should be all merged into budo@10. Thanks!

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

No branches or pull requests

3 participants