wiso
May 28, 2024, 2:08pm
1
I have a web application using next.js (a React framework)
This is my simple component page.tsx
import { openFile } from 'jsroot';
export default function ExamplePage() {
let file = openFile('public/myfile.root');
return (
<> </>
);
}
I get
Module not found: Can't resolve 'gl'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/jsroot/modules/hist/TH2Painter.mjs
./node_modules/jsroot/modules/main.mjs
./src/app/example/page.tsx
I’m sure @linev can help you
linev
May 28, 2024, 2:18pm
3
Did you try to call npm install gl
?
wiso
May 28, 2024, 2:23pm
4
Sure, that is what I was doing, but I wanted to undestand the problem since if I run a node interactive session everything works, e.g.
node
const { openFile } = await import("jsroot");
openfile('myroot.root');
Installing gl works, but then I hit the next dependency
Module not found: Can't resolve 'fflate'
linev
May 28, 2024, 2:27pm
5
Normally npm
install all necessary dependency automatically.
Only if you are using npm install --production
flag some extra dependencies will be skipped.
wiso
May 28, 2024, 2:28pm
6
I am installing with npm install jsroot.
linev
May 28, 2024, 2:55pm
7
Looks like npm
does not install “devDependencies” from jsroot any longer.
To use all jsroot functions one need “gl”, “fflate” and several other modules.
Please try to install them “by hand”
“gl” was removed from normal dependencies some time ago because of install problems on several platforms. Meanwhile problem is resolved - may be I need to add it again.
wiso
May 28, 2024, 9:10pm
8
everything works if I resolve the dependencies manually
linev
May 29, 2024, 8:05am
9
I will add missing dependency to the next jsroot release 7.7.1
system
Closed
June 12, 2024, 8:42am
11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.