etherpad-lite: systemd service file for v2.0 (was: unexpected string in JSON after upgrade to v2)

Describe the bug When running etherpad for the first time after update with sudo -u etherpad bin/run.sh, it complains about an unknown string in the settings, yet I can’t see any difference to the template in the mentioned place.

We are coming from v1.9.2 (as far as I can tell). I had git to pull the latest versions and checked out to tags/v2.0.1, as we always did with previous updates. For the first run I had to run bin/run.sh it as root as otherwise it couldn’t access /usr/local/lib/node_modules otherwise (and I don’t think having the etherpad user own that directory is the best solution). Of course afterwards I re-owned all files in the etherpad directory by the etherpad user. It threw some fatal error - maybe because of tidyHtml setting still present, who knows - so I went through the whole settings.json, compared to the settings.json.template and made the appropriate changes. Yet running the etherpad from shell still results in

[2024-04-04T13:45:48.575] [ERROR] settings - There was an error processing your settings file from /opt/etherpad/etherpad-lite/settings.json: Unexpected string in JSON at position 129
/opt/etherpad/etherpad-lite/src:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  ep_etherpad-lite@2.0.1 dev: `node --import tsx node/server.ts "--emptyOutDir"`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

Or as the whole output:

sudo -u etherpad bin/run.sh --emptyOutDir
Installing dependencies...
Installing dev dependencies with pnpm
Scope: all 4 workspace projects
Lockfile is up to date, resolution step is skipped
Done in 3.5s
Clearing minified cache...
Creating the admin UI...

> admin@2.0.1 build /opt/etherpad/etherpad-lite/admin
> tsc && vite build

vite v5.1.6 building for production...
✓ 1626 modules transformed.

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

computing gzip size (2)...[vite-plugin-static-copy] Copied 1 items.
../src/templates/admin/index.html                   0.49 kB │ gzip:   0.30 kB
../src/templates/admin/assets/index-DxlhTx9-.css    9.20 kB │ gzip:   2.78 kB
../src/templates/admin/assets/index-Cv1HbGYr.js   402.35 kB │ gzip: 128.90 kB
✓ built in 7.97s
Starting Etherpad...

> etherpad@2.0.1 dev /opt/etherpad/etherpad-lite
> pnpm --filter ep_etherpad-lite run dev "--emptyOutDir"


> ep_etherpad-lite@2.0.1 dev /opt/etherpad/etherpad-lite/src
> node --import tsx node/server.ts "--emptyOutDir"

[2024-04-04T13:45:48.554] [INFO] settings - All relative paths will be interpreted relative to the identified Etherpad base dir: /opt/etherpad/etherpad-lite
[2024-04-04T13:45:48.575] [ERROR] settings - There was an error processing your settings file from /opt/etherpad/etherpad-lite/settings.json: Unexpected string in JSON at position 129
/opt/etherpad/etherpad-lite/src:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  ep_etherpad-lite@2.0.1 dev: `node --import tsx node/server.ts "--emptyOutDir"`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

Here is the current settings.json we use, obviously with passwords redacted: settings.json

Now I don’t know how json interpreters read positions. But the only two positions that should be possible for position 129 should be either

{
  /*                                                                                                                                                                     
   * Name your instance!                                                                                                                                                 
   */
  "title": "Etherpad",

or

"favicon": null,

But in both cases there’s no difference, even diff can’t find one there. So what exactly is the issue?

Server (please complete the following information):

  • Etherpad version: v2.0.1
  • OS: [e.g., Ubuntu 20.04]: Debian 12.5
  • Node.js version (node --version): v18.19.0
  • npm version (npm --version): 9.2.0
  • pnpm version (pnpm --version): 8.15.6
  • Is the server free of plugins: -

About this issue

  • Original URL
  • State: open
  • Created 3 months ago
  • Comments: 30 (14 by maintainers)

Most upvoted comments

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.

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

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.