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.

The basic demo doesn't work.

See original GitHub issue

I’m following the basic demo here: https://github.com/evanw/node-source-map-support#basic-demo

npm install source-map-support

echo 'throw new Error("test"); // This is the original code' > original.js

echo 'require("source-map-support").install();

throw new Error("test"); // This is the compiled code
// The next line defines the sourceMapping.
//# sourceMappingURL=compiled.js.map' > compiled.js

echo '{
  "version": 3,
  "file": "compiled.js",
  "sources": ["original.js"],
  "names": [],
  "mappings": ";;;AAAA,MAAM,IAAI"
}' > compiled.js.map

node compiled.js

And I get:

.../compiled.js:3
throw new Error(test); // This is the compiled code
      ^
Error: test

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:3
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jeremytmcommented, Apr 28, 2017

Thanks team. I’ve got things working.

Part of the reason I thought this was broken and tried the demo is because I couldn’t get it to work in my own project.

The problem turned out to be this line from your README:

Once you have a valid source map, insert the following line at the top of your compiled code:

require('source-map-support').install();

I was inserting this line at the top of an already compiled file (as the instructions said) and then expecting it to work. But my sourcemaps are generated by babel at the same time as compilation, so with an extra line added after the sourcemap had been generated, things got messed up.

The fix ended up being to insert this line in the original file before compilation, and then everything worked.

I’m happy to submit a PR request for the README, but could someone confirm that how I’m doing things is correct?

1reaction
szhucommented, Mar 8, 2016

Oh there’s also #97

Read more comments on GitHub >

github_iconTop Results From Across the Web

Well the demo doesn't work : r/Steam
Open this new .reg file and it will ask if you want to apply the fix, say yes. Game should now work.
Read more >
5 Ways to Fix Steam if The Download Demo Button is Not ...
If your Steam download demo button is not working, do not panic, hop on this article to find out the best troubleshooting fixes....
Read more >
(BUG) Issues with unavailable demos blocking the ...
1. Find the demo's install link on Steam DB · 2. Start the install · 3. Stop the install · 4. Uninstall the...
Read more >
What to Do When Your Demo Fails
What to Do When Your Demo Fails · Tip 1: If it's small, don't acknowledge it · Tip 2: Resist the urge to...
Read more >
Your Product Demo Sucks Because It's Focused on Your ...
Good demos don't have to be perfect for the product. They have to be perfect for the audience. No matter who you're meeting...
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