mpedramfar / zotra-server

GNU Affero General Public License v3.0
12 stars 3 forks source link

Need help with the error #5

Open lnguyen4 opened 1 month ago

lnguyen4 commented 1 month ago

Hi , Thank you for creating this package and I have been using it successfully to work with bibtex entry and editing for my personal paper collection on emacs.

Until today, I got this error when emacs tried to pull the entry for an Arxiv item. I believe it is something with node. I included the picture of the debug on emacs. I am using endeavourOS ( an archlinux based OS) and usually i started the selfhost local sever by using the command

pm2 start index.js

Then I would proceed like normal on emacs with zotra.

Please guide me to ways to fix this

Thank you emacs_zotra

EDIT: i looked around and was able to fix it.

Utils.IsRegExp and Utils.IsDate are deprecated API so change the code in the config.js respectively

parent instanceof RegExp

parent instanceof Date

renbus commented 1 week ago

I just installed zotra-server and I got the same error. The tip from lnguyen4 seems to work (thanks a lot!).

At first, it wasn't very clear to me what I had to do exactly, in the end I got it to work by replacing, in the .../zotra-server/node-modules/config/lib/config.js file, the line 1217, } else if (Utils.isRegExp(parent)) {, by:

} else if (parent instanceof RegExp) {

And the line 1220, } else if (Utils.isDate(parent)) {, by:

} else if (parent instanceof Date) {

mpedramfar commented 6 days ago

It seems like the issue is from using deprecated node functions in the upstream repository. Specifically, the functions you mentioned are deprecated in node 23: https://nodejs.org/api/deprecations.html#DEP0055

The fact is that these functions are not used in this repo. Zotra server is a very thin wrapper around the Zotero translation server and these issues should be resolved there: https://github.com/zotero/translation-server/issues/176

The easiest solution for now is to use node version <= 22, or alternatively use the fix suggested by @lnguyen4. I'll keep this issue open so other users who get this error could see it.