zotero / web-library

Other
143 stars 46 forks source link

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

Closed markdoerr closed 4 months ago

markdoerr commented 1 year ago

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

Huaweidev commented 1 year ago

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.
markdoerr commented 1 year ago

@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 ...

Huaweidev commented 1 year ago

@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

markdoerr commented 1 year ago

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

tnajdek commented 1 year ago

@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.

markdoerr commented 1 year ago

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 !

tnajdek commented 1 year ago

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

tnajdek commented 4 months ago

Fixed in 469ccd5cb95178f8ed08445a7e9d82e780f3b832