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.

jsroot node basic example not working

See original GitHub issue

Hi there,

I’m probably doing something (really) stupid, but I can’t get some basic example to work.

What I’m doing :

npm init -y
npm install jsroot
copy and paste code from https://root.cern/js/latest/api.htm#node_js_create_svg_src into first.js
node first.js

The result is :

~/tmp/testjsroot$ node --version
v12.18.1
~/tmp/testjsroot$ node first.js
JSROOT version 5.9.0 9/10/2020
load scripts/rawinflate.min.js
load scripts/JSRootIOEvolution.js
/Users/laurent/tmp/testjsroot/first.js:12
  .then((file) => file.ReadObject("hpxpy;1"))
  ^

TypeError: Cannot read property 'then' of undefined
    at Object.<anonymous> (/Users/laurent/tmp/testjsroot/first.js:12:3)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

If I’m trying with the non-promise version it works though :

~/tmp/testjsroot$ curl https://root.cern/js/latest/demo/node/makesvg.js >| test.js && node test.js
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   551  100   551    0     0   5565      0 --:--:-- --:--:-- --:--:--  5565
JSROOT version 5.9.0 9/10/2020
load scripts/rawinflate.min.js
load scripts/JSRootIOEvolution.js
load scripts/d3.min.js
load scripts/JSRootPainter.js
Reuse existing d3.js 5.16.0, expected 5.7.0
load scripts/JSRootPainter.v6.js
load scripts/JSRootPainter.hist.js
load scripts/three.min.js
load scripts/three.extra.min.js
load scripts/JSRoot3DPainter.js
load scripts/JSRootPainter.hist3d.js
THREE.SVGRenderer 102
First render tm = 75
SVG size 253859

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
aphecetchecommented, Nov 6, 2020

Thanks. One last question if I may : will 6.0 include Typescript type definitions by any chance ?

0reactions
linevcommented, Feb 10, 2021

I closing issue - JSROOT v6 was released. If you want to have Typescript type definitions file, please open new issue and provide example - I found some examples with modules, but JSROOT v6 do not use modules yet

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript ROOT - CERN
The JSROOT project allows: - reading of binary and JSON ROOT files in JavaScript; - drawing of different ROOT classes in web browsers;...
Read more >
Root not working for admin pannel in node js - Stack Overflow
Your user routes are with the endpoint '/' in server.js.So its working,where as admin need to be linked like /admin/add-faq.
Read more >
Howto configure if node.js server is not installed in module ...
Hi all, I'm having a hard time getting this module to talk with my server. Node.js is installed and seems to be running,...
Read more >
Determining your app's base directory in Node.js
Determining your app's base dir (or document root if you're from a PHP background) isn't as straight forward as you'd think in Node....
Read more >
HTTP Response Splitting in Node.js - Root Cause Analysis
Particularly the problem is with how Unicode data is serialized. Keep in mind that Javascript strings (Javascript is the language Node.js ...
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