zotero / translation-server

A Node.js-based server to run Zotero translators
Other
117 stars 49 forks source link

Error: Cannot find module 'w3c-xmlserializer/lib/XMLSerializer' #143

Open gtaillefer opened 1 year ago

gtaillefer commented 1 year ago

Since the last, post, I have managed to figure out most of the problems, but not all. I figured out that I needed to install many missing packages of which I could see were missing through npm outdated. I then downloaded all the missing packages, and then awaited to see if npm start would finally work, until it didn't. When I typed in npm start, it gave me this:

Error: Cannot find module 'w3c-xmlserializer/lib/XMLSerializer'

Require stack:

- /home2/wwiiarch/zotero/src/translation/translate.js

- /home2/wwiiarch/zotero/src/zotero.js

- /home2/wwiiarch/zotero/src/server.js

    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 Object.<anonymous> (/home2/wwiiarch/zotero/src/translation/translate.js:44:24)

    at Module._compile (node:internal/modules/cjs/loader:1155:14)

    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)

    at Module.load (node:internal/modules/cjs/loader:1033:32)

    at Function.Module._load (node:internal/modules/cjs/loader:868:12)

    at Module.require (node:internal/modules/cjs/loader:1057:19) {

  code: 'MODULE_NOT_FOUND',

  requireStack: [

    '/home2/wwiiarch/zotero/src/translation/translate.js',

    '/home2/wwiiarch/zotero/src/zotero.js',

    '/home2/wwiiarch/zotero/src/server.js'

  ]

}

I tried npm install w3c-xmlserializer/lib/XMLSerializer but it gives me the following error:

npm ERR! code ENOENT

npm ERR! syscall open

npm ERR! path /home2/wwiiarch/zotero/w3c-xmlserializer/lib/XMLSerializer/package.json

npm ERR! errno -2

npm ERR! enoent ENOENT: no such file or directory, open '/home2/wwiiarch/zotero/w3c-xmlserializer/lib/XMLSerializer/package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR!     /home2/wwiiarch/.npm/_logs/2022-11-11T02_13_24_366Z-debug-0.log

I checked in the w3c-xmlserializer/lib/folder to see if there was a XMLSerializer, but there wasn't, just the .js files in there. I have no idea how to fix this so if anyone can that'd be great

My specs now are:

CentOS 6

shared hosting bluehost cpanel

node v16.18.1

npm 8.19.2

Thanks

gtaillefer commented 1 year ago

Ok so I think I partially fixed the problem. I found the tgz file for w3c-xmlseralizer 1.0.1: https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.0.1.tgz, and I had looked through and found the XMLSerializer.js, XMLSerializer-impl.js, and serialization files and put them into the lib directory. That then led me to do npm start again which prompted me with this: /home2/wwiiarch/zotero/src/translation/translate.js:48 Object.defineProperty(Attr.interface.prototype, 'innerText', { ^

TypeError: Cannot read properties of undefined (reading 'prototype') at Object. (/home2/wwiiarch/zotero/src/translation/translate.js:48:38) at Module._compile (node:internal/modules/cjs/loader:1155:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10) at Module.load (node:internal/modules/cjs/loader:1033:32) at Function.Module._load (node:internal/modules/cjs/loader:868:12) at Module.require (node:internal/modules/cjs/loader:1057:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home2/wwiiarch/zotero/src/zotero.js:105:20) at Module._compile (node:internal/modules/cjs/loader:1155:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)