question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Snippet can't be loaded from server

See original GitHub issue

scr_2015-08-27_03-41-12_pm

<script type='text/javascript' id="__bs_script__">//<![CDATA[
    document.write("<script async src='http://HOST:3000/browser-sync/browser-sync-client.2.8.0.js'><\/script>".replace("HOST", location.hostname));
//]]></script>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:34 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
sc0ttwad3commented, Sep 9, 2015

Adding my experience with this issue and what so far has become my workaround…

Starting with a fully working app that uses browser-sync with no issues. I make a copy of this working go-to starter kit project, change minor textual issues (project name, etc.) and run the app in development mode, where index.html loads with no problem, until about a week ago and every time since – the start page in the browser-sync development server, has a 404 for browser-sync-client.2.8.2.js – as mentioned by others above.

After days of hunting this down and following various false leads, unsuccessfully, I did something similar to what I see suggested in a comment above: Before the closing </body> tag of my start page I manually entered:

<script async="" src="/browser-sync/browser-sync-client.js"></script>

Subsequent loading of the start page, no longer contains the 404, the page and site run without issues and the following code gets inserted as the first lines after the opening <body> tag:

<script type="text/javascript" id="__bs_script__">//<![CDATA[
document.write("<script async src='/browser-sync/browser-sync-client.2.9.3.js'><\/script>".replace("HOST", location.hostname));//]]></script>
<script async="" src="/browser-sync/browser-sync-client.2.9.3.js"></script>

Next, I remove the script tag I manually entered. The very next run of the app and the start page load, everything works correctly, no 404s and the same lines as above are inserted into the document.

So my workaround is to manually enter the script once that references browser-sync-client.js no version, load the site. close the site, remove the manually entered script, and from then on everything is fine.

This feels like somehow a reference to 2.8.2 is cached or lying around somewhere, that after manually entering the client script reference, it flushes that, and thereafter the correct script reference gets inserted.

Any updates on this issue or know of a better workaround, I see a reference to using the scriptPath option?

1reaction
shakyShanecommented, Aug 31, 2015

Can you run it again, then try http://localhost:3000/browser-sync/browser-sync-client.js in a browser…

Read more comments on GitHub >

github_iconTop Results From Across the Web

code snippets not working - Visual Studio Feedback
When i'm trying using any code snippet like "prop" it does not show up in the list. And if i type "prop" and...
Read more >
VS13/VS15 - can't import SQL snippet - Stack Overflow
I fixed this by going into the snippet manager and specifying the Language, VB or CSharp, and adding the snippets to the correct...
Read more >
Problem with Code Snippets that use JavaScript - Zoho Cares
You may add the code in the same format that you mentioned and check if it makes any difference. If not, kindly enable...
Read more >
Tips for Using Snippets in Your Shopify Theme Work
If you have worked with server-side languages you will already be familiar ... Similarly, variables assigned within the snippet can't be ...
Read more >
Code Snippets - CKEditor 4 Documentation
The optional Code Snippet plugin allows you to insert rich code fragments and ... the highlighter stylesheet will not be loaded automatically by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found