Giter Club home page Giter Club logo

Comments (31)

SamTV12345 avatar SamTV12345 commented on May 29, 2024 1

You can give it a try with
ExecStart=/usr/bin/node --experimental-worker --import=tsx /opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.ts. You need NodeJS 20 for that.

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024 1

It handles it better than npm. You can just pull from GitHub with git and then do pnpm install.

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024 1

Wait you are again at NodeJS 20.5.1. Try it only with NodeJS 21 and it should work :)

As you recommended NodeJS 20 and as that's the latest LTS release, I was using that. But yes, after upgrading to 21 it finally works now. Would be great though if the minimal Node version would be clarified as the readme still lists "Node.js >= 18.18.2" as requirement. Also it would be great if the LTS versions would be the minimal required version, not the latest latest. Servers usually use distros like Debian, Ubuntu LTS and what not for a reason.

Now after having it running, I'm noticing a different issue: the admin user defined in the settings.json - that still worked back on v1.9.7 that I installed in the meantime - isn't able to log in anymore. The Etherpad just says "login failed" when navigating to /admin/settings and entering the account data into the new mask. "showSettingsInAdminPage": true, is set, just as

 "users": {
    "admin": {
      // 1) "password" can be replaced with "hash" if you install ep_hash_auth      
      // 2) please note that if password is null, the user will not be created      
      "password": "password",
      "is_admin": true
    },
  },

The eplite.error.log is empty.

@webzwo0i found a way to run Etherpad with NodeJS<21 but code changes are required so this will be fixed in a future version.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

After finding a json linter that's able to handle comments, I noticed that my skinVariants constructs isn't correct, I've probably misunderstood that the option was there to define multiple themes. Also I forgot to close the second bracket from the users entry. The issue now is a working systemd service file node_modules/ep_etherpad-lite/node/server.js doesn't seem to exist anymore. But there are now several server.js files:

./src/node_modules/.ignored_etherpad-yajsml/server.js
./node_modules/.pnpm/[email protected]/node_modules/etherpad-yajsml/server.js
./node_modules/.pnpm/[email protected]/node_modules/engine.io/build/server.js
./node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/server.js
./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/react-router-dom/dist/server.js
./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/react-router-dom/server.js
./node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/server.js

Which one would I need for the systemd file? The line I use to start the systemd service is
ExecStart=/usr/bin/node --experimental-worker /opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

Good to know. But how do I get the scripts to install all relevant dependencies? Because now when I run the run.sh, it gives me these errors:

WARN  Failed to create bin at /opt/etherpad/etherpad-lite/bin/node_modules/.bin/etherpad-lite. ENOENT: no such file or directory, open '/opt/etherpad/etherpad-lite/src/node/server.ts'
 WARN  Failed to create bin at /opt/etherpad/etherpad-lite/node_modules/.bin/etherpad-lite. ENOENT: no such file or directory, open '/opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.ts'
 WARN  Failed to create bin at /opt/etherpad/etherpad-lite/bin/node_modules/.bin/etherpad-lite. ENOENT: no such file or directory, open '/opt/etherpad/etherpad-lite/bin/node_modules/ep_etherpad-lite/node/server.ts'
 WARN  Failed to create bin at /opt/etherpad/etherpad-lite/node_modules/.bin/etherpad-lite. ENOENT: no such file or directory, open '/opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.ts'

Even removing the lock file doesn't fix this. Also the script keeps complaining about

(!) outDir /opt/etherpad/etherpad-lite/src/templates/admin is not inside project root and will not be emptied.
Use --emptyOutDir to override

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

You can do pnpm i in the root Etherpad directory. The second warning is normal and is nothing you need to worry about. We copy the admin pages into Etherpad and the admin directory is separate of Etherpad.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

The files still don't exits

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Im wondering why. You did clone the GitHub repository?

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

Yes. And I just had git sync up again (git pull origin develop, as for some reason the v2.0.1 tag isn't part of master), yet no fix.

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Can you remove all node_modules folder in every directory and then do pnpm I again? Maybe something got out of sync.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

I had find delete all node_modules directories, had git pull from origin, checked out tags/v2.0.1, ran pnpm i, yet no change (all commands ran as the etherpad user owning the whole directory).

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

So you still get errors? Can you list every command on your Linux VM? Maybe I can replicate that.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

Well I started from v1.9.2. Then

git pull origin
git tag
git checkout tags/v2.0.1
bin/run.sh

All until now as the etherpad user. Because v2 switched to pnpm which works fundamentally different (and maybe because I didn't really initialize pnpm) it couldn't access somwhere in /usr/libs for the pnpm modules directory. So I ran bin/run.sh --root and afterwards chown -R etherpad:etherpad ./ to reset ownership. And another run of run.sh as the etherpad user that resulted in the first post. After you said server.ts could be ran by nodejs 20, I upgraded to that from v18 (via their Debian repo), changed the line in the service file, started the job and saw the errors in the journal:

Apr 05 22:21:53 www systemd[1]: etherpad.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 22:21:53 www systemd[1]: etherpad.service: Failed with result 'exit-code'.
Apr 05 22:21:56 www systemd[1]: etherpad.service: Scheduled restart job, restart counter is at 7566.
Apr 05 22:21:56 www systemd[1]: Stopped etherpad.service - Etherpad-lite, the collaborative editor..
Apr 05 22:21:56 www systemd[1]: Started etherpad.service - Etherpad-lite, the collaborative editor..
Apr 05 22:21:56 www node[1609258]: node:internal/errors:496
Apr 05 22:21:56 www node[1609258]:     ErrorCaptureStackTrace(err);
Apr 05 22:21:56 www node[1609258]:     ^
Apr 05 22:21:56 www node[1609258]: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'tsx' imported from /opt/etherpad/etherpad-lite/
Apr 05 22:21:56 www node[1609258]:     at new NodeError (node:internal/errors:405:5)
Apr 05 22:21:56 www node[1609258]:     at packageResolve (node:internal/modules/esm/resolve:782:9)
Apr 05 22:21:56 www node[1609258]:     at moduleResolve (node:internal/modules/esm/resolve:831:20)
Apr 05 22:21:56 www node[1609258]:     at defaultResolve (node:internal/modules/esm/resolve:1036:11)
Apr 05 22:21:56 www node[1609258]:     at DefaultModuleLoader.resolve (node:internal/modules/esm/loader:251:12)
Apr 05 22:21:56 www node[1609258]:     at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:140:32)
Apr 05 22:21:56 www node[1609258]:     at DefaultModuleLoader.import (node:internal/modules/esm/loader:227:28)
Apr 05 22:21:56 www node[1609258]:     at node:internal/process/esm_loader:34:84
Apr 05 22:21:56 www node[1609258]:     at node:internal/per_context/primordials:544:39
Apr 05 22:21:56 www node[1609258]:     at new Promise (<anonymous>) {
Apr 05 22:21:56 www node[1609258]:   code: 'ERR_MODULE_NOT_FOUND'
Apr 05 22:21:56 www node[1609258]: }
Apr 05 22:21:56 www node[1609258]: Node.js v20.5.1
Apr 05 22:21:56 www systemd[1]: etherpad.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 22:21:56 www systemd[1]: etherpad.service: Failed with result 'exit-code'.

So I installed tsx with pnpm (as root and form the root users home directory), but that issue actually continues showing up in the journal. But executing pnpm install tsx from etherpads root directory as etherpad user results in this message
 ERR_PNPM_ADDING_TO_ROOT  Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.
So I did not yet try that again. Everything after that was just a mix of git pull origin develop, git checkout tags/v2.0.1, find . -name "node_modules" -type d -exec rm -r {} \; and bin/run.sh.

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Adapt your systemd service to this. That should hopefully work.

[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad
Environment=NODE_ENV=production
ExecStart=pnpm run prod
# use mysql plus a complete settings.json to avoid Service hold-off time over, scheduling restart.
Restart=always

[Install]
WantedBy=multi-user.target

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

It still gives me the same complaints
etherpad.log

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Can you go to the folder and do manually pnpm run prod?

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024
> [email protected] prod /opt/etherpad/etherpad-lite
> pnpm --filter ep_etherpad-lite run prod


> [email protected] prod /opt/etherpad/etherpad-lite/src
> node --import tsx node/server.ts

node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/etherpad/etherpad-lite/src/node/server.ts' imported from /opt/etherpad/etherpad-lite/src/
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at new NodeError (node:internal/errors:405:5)
    at finalizeResolution (node:internal/modules/esm/resolve:226:11)
    at moduleResolve (node:internal/modules/esm/resolve:838:10)
    at defaultResolve (node:internal/modules/esm/resolve:1036:11)
    at DefaultModuleLoader.resolve (node:internal/modules/esm/loader:251:12)
    at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:140:32)
    at DefaultModuleLoader.import (node:internal/modules/esm/loader:227:28)
    at node:internal/modules/run_main:56:28
    at loadESM (node:internal/process/esm_loader:40:13)
    at async handleMainPromise (node:internal/modules/run_main:66:12) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v20.5.1
/opt/etherpad/etherpad-lite/src:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] prod: `node --import tsx node/server.ts`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

If you did pnpm install before tsx should be there.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

I know that it should. Just to be sure, just ran it again:

sudo -u etherpad pnpm install
Scope: all 4 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
 WARN  Failed to create bin at /opt/etherpad/etherpad-lite/bin/node_modules/.bin/etherpad-lite. ENOENT: no such file or directory, open '/opt/etherpad/etherpad-lite/src/node/server.ts'
 WARN  Failed to create bin at /opt/etherpad/etherpad-lite/node_modules/.bin/etherpad-lite. ENOENT: no such file or directory, open '/opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.ts'
 WARN  Failed to create bin at /opt/etherpad/etherpad-lite/node_modules/.bin/etherpad-lite. ENOENT: no such file or directory, open '/opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.ts'
 WARN  Failed to create bin at /opt/etherpad/etherpad-lite/bin/node_modules/.bin/etherpad-lite. ENOENT: no such file or directory, open '/opt/etherpad/etherpad-lite/bin/node_modules/ep_etherpad-lite/node/server.ts'
Done in 3.8s

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Im wondering why there should be only 4. develop has already 6 workspaces.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

No idea

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Other than that go to the package.json and remove the bin section. We don't really use it anymore so it should be safe to delete that.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

Result is still the same

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

What exactly would it take to redo the installation from scratch? I can just save the settings.json and APIKEY.txt, purge the rest and pull everything fresh from github. The pads themselves are stored in the database.

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Etherpad is since v2 a 1 line installation. You can just do pnpm I and everything installs itself. If you pull from develop you can even get rid of the apikey.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

I do need the APIkey as there is no other method left afaik for communication between etherpad and other software for reading from and writing to pads.

How is it with updates? How well can pnpm handle those? With git it was always quite easy. Also it's very easy with git to roll back to an older version if you find some issue (just like I did) and just don't have the time to bother with it at the moment.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

Just done that, it tells me that it doesn't know the file extension .ts (after running pnpm run prod in the directory):

sudo -u etherpad pnpm run prod

> [email protected] prod /opt/etherpad
> pnpm --filter ep_etherpad-lite run prod


> [email protected] prod /opt/etherpad/src
> node --import tsx node/server.ts

node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /opt/etherpad/src/node/server.ts
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at new NodeError (node:internal/errors:405:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:142:36)
    at defaultLoad (node:internal/modules/esm/load:91:20)
    at DefaultModuleLoader.load (node:internal/modules/esm/loader:263:26)
    at DefaultModuleLoader.moduleProvider (node:internal/modules/esm/loader:179:22)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at #createModuleJob (node:internal/modules/esm/loader:203:17)
    at DefaultModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:156:34)
    at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:141:17)
    at DefaultModuleLoader.import (node:internal/modules/esm/loader:227:28)
    at node:internal/modules/run_main:56:28
    at loadESM (node:internal/process/esm_loader:40:13)
    at async handleMainPromise (node:internal/modules/run_main:66:12) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Node.js v20.5.1
/opt/etherpad/src:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] prod: `node --import tsx node/server.ts`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

even after adding tsx to the workspace root (pnpm install tsx -w)

EDIT: removing type: module from packages.json as recommended in a few different places doesn't help.

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

My guess is this may be somehow related to TypeStrong/ts-node#1062 and similar issues as this seems to be quite a common error. Meanwhile I went back to v1.9.7 until v2 has found a solution that's more reliable than 50 % of the time.

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Just done that, it tells me that it doesn't know the file extension .ts (after running pnpm run prod in the directory):

sudo -u etherpad pnpm run prod

> [email protected] prod /opt/etherpad
> pnpm --filter ep_etherpad-lite run prod


> [email protected] prod /opt/etherpad/src
> node --import tsx node/server.ts

node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /opt/etherpad/src/node/server.ts
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at new NodeError (node:internal/errors:405:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:142:36)
    at defaultLoad (node:internal/modules/esm/load:91:20)
    at DefaultModuleLoader.load (node:internal/modules/esm/loader:263:26)
    at DefaultModuleLoader.moduleProvider (node:internal/modules/esm/loader:179:22)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at #createModuleJob (node:internal/modules/esm/loader:203:17)
    at DefaultModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:156:34)
    at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:141:17)
    at DefaultModuleLoader.import (node:internal/modules/esm/loader:227:28)
    at node:internal/modules/run_main:56:28
    at loadESM (node:internal/process/esm_loader:40:13)
    at async handleMainPromise (node:internal/modules/run_main:66:12) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Node.js v20.5.1
/opt/etherpad/src:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] prod: `node --import tsx node/server.ts`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

even after adding tsx to the workspace root (pnpm install tsx -w)

EDIT: removing type: module from packages.json as recommended in a few different places doesn't help.

Wait you are again at NodeJS 20.5.1. Try it only with NodeJS 21 and it should work :)

from etherpad-lite.

Artim96 avatar Artim96 commented on May 29, 2024

Wait you are again at NodeJS 20.5.1. Try it only with NodeJS 21 and it should work :)

As you recommended NodeJS 20 and as that's the latest LTS release, I was using that. But yes, after upgrading to 21 it finally works now. Would be great though if the minimal Node version would be clarified as the readme still lists "Node.js >= 18.18.2" as requirement. Also it would be great if the LTS versions would be the minimal required version, not the latest latest. Servers usually use distros like Debian, Ubuntu LTS and what not for a reason.

Now after having it running, I'm noticing a different issue: the admin user defined in the settings.json - that still worked back on v1.9.7 that I installed in the meantime - isn't able to log in anymore. The Etherpad just says "login failed" when navigating to /admin/settings and entering the account data into the new mask.
"showSettingsInAdminPage": true,
is set, just as

 "users": {
    "admin": {
      // 1) "password" can be replaced with "hash" if you install ep_hash_auth      
      // 2) please note that if password is null, the user will not be created      
      "password": "password",
      "is_admin": true
    },
  },

The eplite.error.log is empty.

from etherpad-lite.

SamTV12345 avatar SamTV12345 commented on May 29, 2024

Wait you are again at NodeJS 20.5.1. Try it only with NodeJS 21 and it should work :)

As you recommended NodeJS 20 and as that's the latest LTS release, I was using that. But yes, after upgrading to 21 it finally works now. Would be great though if the minimal Node version would be clarified as the readme still lists "Node.js >= 18.18.2" as requirement. Also it would be great if the LTS versions would be the minimal required version, not the latest latest. Servers usually use distros like Debian, Ubuntu LTS and what not for a reason.

Now after having it running, I'm noticing a different issue: the admin user defined in the settings.json - that still worked back on v1.9.7 that I installed in the meantime - isn't able to log in anymore. The Etherpad just says "login failed" when navigating to /admin/settings and entering the account data into the new mask. "showSettingsInAdminPage": true, is set, just as

 "users": {
    "admin": {
      // 1) "password" can be replaced with "hash" if you install ep_hash_auth      
      // 2) please note that if password is null, the user will not be created      
      "password": "password",
      "is_admin": true
    },
  },

The eplite.error.log is empty.

This is finally merged. You can continue running the startup commands as before but it is now NodeJS18 compatible

from etherpad-lite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.