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.

Cannot read local file (under node) ?

See original GitHub issue

I’m trying to do a very basic thing, opening a file :

cat index.js
const jsroot = require("jsroot");

console.log("JSROOT version", jsroot.version);

jsroot
  //.openFile("https://root.cern.ch/js/files/hsimple.root") // WORKS
  .openFile("file://hsimple.root") // DOES NOT WORK
  .then((file) => console.log(file))
  .catch((err) => console.log("boum",err));

node index.js works if the file is remote but for the local case I get :

JSROOT version 6.0.0 14/01/2021
boum ReferenceError: filename is not defined
    at /Users/laurent/gitlab.cern.ch/alice-muon/testjsroot/node_modules/jsroot/scripts/JSRoot.io.js:2435:23
    at new Promise (<anonymous>)
    at TNodejsFile._open (/Users/laurent/gitlab.cern.ch/alice-muon/testjsroot/node_modules/jsroot/scripts/JSRoot.io.js:2434:14)
    at Object.JSROOT.openFile (/Users/laurent/gitlab.cern.ch/alice-muon/testjsroot/node_modules/jsroot/scripts/JSRoot.io.js:3113:19)
    at /Users/laurent/gitlab.cern.ch/alice-muon/testjsroot/node_modules/jsroot/scripts/JSRoot.core.js:1340:53
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

what am I missing 😉 ?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
linevcommented, Mar 1, 2021
1reaction
linevcommented, Mar 1, 2021

I will provide 6.0.1 tag today or tomorrow. Next 6.1 version with TRatioPlot support will be released in next 2-3 weeks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't load local files when using NodeJS server - Stack Overflow
A web server in node.js does not serve ANY files by default (unlike some other web servers). So, if you want js files...
Read more >
How do I read files in Node.js?
The easiest way to read the entire contents of a file is with fs. ... try to read an invalid file - the...
Read more >
How to work with files on Databricks
You can work with files on DBFS, the local driver node of the cluster, cloud object storage, external locations, and in Databricks Repos....
Read more >
Explain about Read and Write of a file using JavaScript
Let's demonstrate some examples of reading and writing files with the node.js fs module. The fs.readFile() and rs.writeFile() methods are used ...
Read more >
How to read and write files in Node.js
The simplest way to read a file in Node.js is to use the fs.readFile() method by passing the file path, encoding, and a...
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