jsroot icon indicating copy to clipboard operation
jsroot copied to clipboard

An error occurs using npm i jsroot. Is my node version wrong?

Open Chunxiao7 opened this issue 1 year ago • 5 comments

An error occurs using npm i jsroot. Is my node version wrong?

Chunxiao7 avatar Jun 12 '24 13:06 Chunxiao7

Can you provide more information - your platform, node version.

Latest jsroot requires at least node18 to work.

linev avatar Jun 12 '24 13:06 linev

The platform is windows11 and the node version is 18.20.3. The following error message is displayed:

`PS D:\New_Desktop\vue-project> npm i jsroot
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Use your platform's native DOMException instead
npm warn deprecated [email protected]: This package is no longer supported.
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     'D:\\New_Desktop\\vue-project\\node_modules\\canvas',
npm warn cleanup     [Error: EBUSY: resource busy or locked, rmdir 'D:\New_Desktop\vue-project\node_modules\canvas'] {
npm warn cleanup       errno: -4082,
npm warn cleanup       code: 'EBUSY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'D:\\New_Desktop\\vue-project\\node_modules\\canvas'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     'D:\\New_Desktop\\vue-project\\node_modules\\canvas',
npm warn cleanup     [Error: EBUSY: resource busy or locked, rmdir 'D:\New_Desktop\vue-project\node_modules\canvas'] {
npm warn cleanup       errno: -4082,
npm warn cleanup       code: 'EBUSY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'D:\\New_Desktop\\vue-project\\node_modules\\canvas'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm error code 1
npm error path D:\New_Desktop\vue-project\node_modules\gl
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild
npm error prebuild-install warn install unable to verify the first certificate
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | win32 | x64`

Chunxiao7 avatar Jun 12 '24 14:06 Chunxiao7

I have no experience with node on Windows. Do you have 32-bits or 64-bits Windows?

On our test platforms it somehow works:

https://github.com/root-project/jsroot/actions/runs/9465458115/job/26075018335

On your platform problem seems to be with gl package. Do you have all necessary components as listed here:

https://www.npmjs.com/package/gl#windows

Can you try just npm i gl?

linev avatar Jun 12 '24 14:06 linev

I recently experience the same error. What is happening? One of the dependencies - gl, tries to build some C++ code on your machine. For this it uses node-gyp, which in turn, should use your machine compiler and installed libraries. node-gyp requires a build environment and is usual source of problems. In particular usually it tries to use a system library and then build it if it is not found.

  1. On Windows, you may experience npm error gyp ERR. In general, you need to install and make available modern python version and MS C++ redistributable.
    The later might be installed standalone or as a bundle of VS Community edition. More in this SO answer

  2. On linux machines you may need libgl and gcc building tools to be installed. E.g. on ubuntu:

    sudo apt-get install -y build-essential libgl1-mesa-dev
    

P.S. IDK if npm error prebuild-install warn install unable to verify the first certificate is the source of a problem as it is marked as warn but labs like to meddle with certificates, then tools can't download source code and other content.

DraTeots avatar Jul 24 '24 18:07 DraTeots

In last jsroot version gl was moved from "devDependencies" into "dependencies" because of this problem:

https://root-forum.cern.ch/t/cannot-use-jsroot-in-next-js-react/

gl module requires for all kinds 3d rendering. Without it one cannot produce images with jsroot.

linev avatar Jul 26 '24 14:07 linev

With jsroot 7.8.0 release you can skip gl installation by npm install jsroot --omit=dev In such case WebGL rendering is not available and will be fallbacked by simplified SVG rendering.

linev avatar Nov 20 '24 17:11 linev