etherpad-lite
etherpad-lite copied to clipboard
MODULE_NOT_FOUND
Describe the bug Installing any plugin seems to break the installation.
To Reproduce Steps to reproduce the behavior:
- Installing clean Etherpad (all runs fine without plugins)
- in /opt/etherpad run $npm install --no-save --legacy-peer-deps ep_adminpads2 (or any other)
- run etherpad (even manually) $/usr/bin/node --experimental-worker ./node_modules/ep_etherpad-lite/node/server.js
Leads to the error:
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '/opt/etherpad/node_modules/ep_etherpad-lite/node/server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Expected behavior It should install a pluginand run the pad.
Server (please complete the following information):
- Etherpad version: 1.8.18
- OS: Ubuntu 20.04
- Node.js version 14.20.0
- npm version 6.14.15
- Is the server free of plugins: yes (before I try to install one)
NOTE: This seems to happen with any of the plugins. My example with adminpads2 is just one of many.
Calling ./bin/installDeps.sh afterwards fixes the issue but causes all plugins to be "removed" afterwards so that is no solution.
Had another look at what is happening and saw that the npm install calls area clearing the node_modules folder except for the newly installed package and a .package-lock.json file.
E.g. when calling
npm install --no-save --legacy-peer-deps ep_align
only the ep_align package and it's dependencies are there (and the rest got deleted).
I have the same issue.
Unfortunatelly the same behavior here with Node v18.14.0 and etherpad 1.8.18
/usr/bin/node --experimental-worker ./node_modules/ep_etherpad-lite/node/server.js
node:internal/modules/cjs/loader:1050
throw err;
^
Error: Cannot find module '/usr/local/etherpad/node_modules/ep_etherpad-lite/node/server.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
at Module._load (node:internal/modules/cjs/loader:893:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I also have this same issue. Installing a plugin using the following command erased all the node_modules: npm install --no-save --legacy-peer-deps ep_webrtc
The issue you're encountering with Etherpad plugins being removed when you install them is likely due to a conflict or issue with the way npm manages dependencies and handles the node_modules directory. It's essential to address this problem to ensure you can install and use plugins successfully.
I ran into the same problem. Is there already a solution for this, so that I can install plugins?
I use etherpad on an up-to-date Debian installation with Etherpad 1.9.7 (6814aa9) (cloned from git) node 18.19.0 (installed from Debian)
When I run npm version, I get the version 9.2.0, but the logfile tells me plugins - npm --version: 6.14.18.
I ran into the same problem. Is there already a solution for this, so that I can install plugins?
I use etherpad on an up-to-date Debian installation with Etherpad 1.9.7 (6814aa9) (cloned from git) node 18.19.0 (installed from Debian)
When I run
npm version, I get the version 9.2.0, but the logfile tells meplugins - npm --version: 6.14.18.
Oh that is a problem that has been with Etherpad forever. It will be fixed in v2 but for now you need to install npm install -g npm@6 or alternatively use the develop branch.
I tried to install a plugin with npm install -g npm@6 --no-save --legacy-peer-deps and get the following error:
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
Looks to my, that npm install -g npm@6 tries to install the plugin into the system directory and not the local one. Is there another command line parameter which is needed?
I tried to install a plugin with
npm install -g npm@6 --no-save --legacy-peer-depsand get the following error:npm ERR! code EACCES npm ERR! syscall mkdir npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules' npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'mkdir', npm ERR! path: '/usr/local/lib/node_modules' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.Looks to my, that
npm install -g npm@6tries to install the plugin into the system directory and not the local one. Is there another command line parameter which is needed?
You just need to use npm install -g npm@6. The command overrides your version of npm v9.2.0 with npm version 6. This is the last version that works with the old Etherpad release
Thanks. But unfortunately if I just use npm install -g npm@6 <plugin> I get the very same error message …
I guess, -g stands for --global. Shouldn't npm install the plugin locally?
Thanks. But unfortunately if I just use
npm install -g npm@6 <plugin>I get the very same error message …
Yes. Leave out the
Ok, I now got them installed globally under sudo. When I (re)start etherpad, those plugins are not picked up:
Mar 12 21:16:12 qqq systemd[1]: Started etherpad.service - Etherpad-lite, the collaborative editor.
Mar 12 21:16:12 qqq node[2318497]: [2024-03-12T21:16:12.722] [INFO] settings - All relative paths will be interpreted relative to the identified Etherpad base dir: /usr/local/share/etherpad/src
Mar 12 21:16:12 qqq node[2318497]: [2024-03-12T21:16:12.759] [INFO] settings - settings loaded from: /usr/local/share/etherpad/src/settings.json
Mar 12 21:16:12 qqq node[2318497]: [2024-03-12T21:16:12.767] [INFO] settings - No credentials file found in /usr/local/share/etherpad/src/credentials.json. Ignoring.
Mar 12 21:16:12 qqq node[2318497]: [2024-03-12T21:16:12.769] [INFO] settings - Using skin "colibris" in dir: /usr/local/share/etherpad/src/src/static/skins/colibris
Mar 12 21:16:12 qqq node[2318497]: [2024-03-12T21:16:12.769] [WARN] settings - DirtyDB is used. This is not recommended for production. File location: /usr/local/share/etherpad/src/var/dirty.db
Mar 12 21:16:12 qqq node[2318497]: [2024-03-12T21:16:12.771] [INFO] settings - Random string used for versioning assets: 19d93044
Mar 12 21:16:14 qqq node[2318497]: [2024-03-12T21:16:14.930] [INFO] server - Starting Etherpad...
Mar 12 21:16:15 qqq node[2318497]: [2024-03-12T21:16:15.030] [INFO] plugins - check installed plugins for migration
Mar 12 21:16:15 qqq node[2318497]: [2024-03-12T21:16:15.033] [INFO] plugins - Loading plugin ep_etherpad-lite...
Mar 12 21:16:15 qqq node[2318497]: [2024-03-12T21:16:15.048] [INFO] plugins - Loaded 1 plugins
Mar 12 21:16:16 qqq node[2318497]: [2024-03-12T21:16:16.623] [INFO] APIHandler - Api key file read from: "/usr/local/share/etherpad/src/APIKEY.txt"
Mar 12 21:16:16 qqq node[2318497]: [2024-03-12T21:16:16.809] [INFO] server - Installed plugins:
Mar 12 21:16:16 qqq node[2318497]: [2024-03-12T21:16:16.845] [INFO] settings - Report bugs at https://github.com/ether/etherpad-lite/issues
Mar 12 21:16:16 qqq node[2318497]: [2024-03-12T21:16:16.855] [INFO] settings - Your Etherpad version is 1.9.7 (6814aa9)
Mar 12 21:16:16 qqq node[2318497]: [2024-03-12T21:16:16.860] [INFO] settings - SSL -- enabled
Mar 12 21:16:16 qqq node[2318497]: [2024-03-12T21:16:16.861] [INFO] settings - SSL -- server key file: /usr/local/share/etherpad/ssl/epl-server.key
Mar 12 21:16:16 qqq node[2318497]: [2024-03-12T21:16:16.866] [INFO] settings - SSL -- Certificate Authority's certificate file: /usr/local/share/etherpad/ssl/epl-server.crt
Mar 12 21:16:22 qqq node[2318497]: [2024-03-12T21:16:22.242] [INFO] plugins - npm --version: 6.14.18
Mar 12 21:16:22 qqq node[2318497]: [2024-03-12T21:16:22.303] [INFO] http - HTTP server listening for connections
Now you need to install npm install
Thanks for talking me through this. Do you have a tutorial ready for this?
How do I install npm in the etherpad root directory (sorry, I have never worked with nodes and npm before)?
There are many, many version strings in package-lock.json. Which one should I change from 3 to 1?
Oh alright no worries. So first you did
npm install -g npm@6<- This installs the correct npm version- Go to the etherpad directory, into src and remove the package-lock.json file
- Remove the node_modules file
- Do ./bin/installDeps.sh
- Now you should be ready to start etherpad with ./bin/run.sh
Thanks. I followed your step-by-step instructions. I performed 1. as root and 2.-4. as the etherpad user.
The command ./bin/installDeps.sh gives me the following error:
$ bin/installDeps.sh
Installing dependencies...
Installing dev dependencies
npm WARN config optional Use `--omit=optional` to exclude optional dependencies, or
npm WARN config `--include=optional` to include them.
npm WARN config
npm WARN config Default value does install optional deps unless otherwise omitted.
npm ERR! code EUSAGE
npm ERR!
npm ERR! The `npm ci` command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm ERR! later to generate a package-lock.json file, then try again.
npm ERR!
npm ERR! Clean install a project
npm ERR!
npm ERR! Usage:
npm ERR! npm ci
npm ERR!
npm ERR! Options:
npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
npm ERR! [-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
npm ERR! [--legacy-bundling] [--global-style]
npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces] [--include-workspace-root] [--no-install-links]
npm ERR!
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR!
npm ERR! Run "npm help ci" for more info
npm ERR! A complete log of this run can be found in:
npm ERR! /usr/local/share/etherpad/.npm/_logs/2024-03-12T21_29_00_378Z-debug-0.log
Oops. Sorry. Didn't know that the old script was this silly. Then please go before into the src directory and do npm install.
I am a bit confused. Is that what you mean:
sudo npm install -g npm@6<- This installs the correct npm versioncd etherpad/src/rm package-lock.jsonrm -R node_modulesnpm install./bin/installDeps.sh
And then I should be able to install plugins with npm install -g npm@6 --no-save --legacy-peer-deps <ep_plugin>?