web-library icon indicating copy to clipboard operation
web-library copied to clipboard

`npm start` fails with Node.js >=18

Open markdoerr opened this issue 3 years ago • 7 comments

Hi Zotero developers, I am not able to compile the web-library with Node.js 19.0 under linux (latest linux mint). I attached the error messages to the issue.

Do you have any ideas, why this error occurs ? Thanks for your help, mark zotero-web-library-linux-npm19-build-errors.txt

markdoerr avatar Oct 22 '22 21:10 markdoerr

Hi Zotero developers, I am not able to compile the web-library with Node.js 19.0 under linux (latest linux mint). I attached the error messages to the issue.

Do you have any ideas, why this error occurs ? Thanks for your help, mark zotero-web-library-linux-npm19-build-errors.txt

I have the same error, my node-js version is 16.18.0

Error: Cannot find module 'C:\Users\admin\Downloads\web-library-master\modules\zotero-schema\schema.json'
Require stack:
- C:\Users\admin\Downloads\web-library-master\scripts\build-mappings.cjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
    at Function.Module._load (node:internal/modules/cjs/loader:833:27)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at C:\Users\admin\Downloads\web-library-master\scripts\build-mappings.cjs:21:17 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\admin\\Downloads\\web-library-master\\scripts\\build-mappings.cjs'
  ]
}
ERROR: "build:pdf-reader" exited with 1.
ERROR: "build:prepare" exited with 1.

Huaweidev avatar Oct 25 '22 14:10 Huaweidev

@Huaweidev in your case, I am wondering, if you did a recursive subcloning, with git clone --recursive https://github.com/zotero/web-library.git ? This might solve the problem ...

markdoerr avatar Oct 25 '22 14:10 markdoerr

@markdoerr markdoerr

@Huaweidev in your case, I am wondering, if you did a recursive subcloning, with git clone --recursive https://github.com/zotero/web-library.git ? This might solve the problem ...

I run it successfully, share some steps on Ubuntu 22.10:

sudo apt install git nodejs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
source ~/.bashrc
nvm install lts/gallium
nvm use lts/gallium
git clone --recursive https://github.com/zotero/web-library.git
cd web-library/
npm install
npm start

10-26_20-50

Huaweidev avatar Oct 26 '22 12:10 Huaweidev

very cool, thanks a lot @Huaweidev , I will try to reproduce soon :)

markdoerr avatar Oct 26 '22 13:10 markdoerr

@markdoerr as @Huaweidev correctly observed, you need to clone repository recursively, README has been recently updated to reflect that.

The other issue is coming from building zotero/pdf-reader (which is used in web library). I didn't investigate what exactly is causing it in latest Node but generally web library is only tested with Node LTS, as explained in the repo. .nvmrc lists recommended node version. Incidentally we will be switching to 18.x soon.

tnajdek avatar Oct 26 '22 14:10 tnajdek

Thanks a lot, @Huaweidev for the full installation sequence ! With the Node LTS I could manage to install and run it successfully :) @tnajdek : I did not find a hint in the main README, which version of Node one should use. Maybe you could add it to the README in bold letters (or even better the full sequence @Huaweidev posted above) ? That would make it much easier for newbies to get started. Thanks to both again !

markdoerr avatar Oct 29 '22 10:10 markdoerr

This reason for this problem and a workaround is: zotero/pdf-worker#18

tnajdek avatar Nov 14 '22 15:11 tnajdek

Fixed in 469ccd5cb95178f8ed08445a7e9d82e780f3b832

tnajdek avatar May 03 '24 12:05 tnajdek