Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install plugin in the Etherpad Docker image #6081

Closed
narthur opened this issue Dec 20, 2023 · 12 comments
Closed

Can't install plugin in the Etherpad Docker image #6081

narthur opened this issue Dec 20, 2023 · 12 comments

Comments

@narthur
Copy link

narthur commented Dec 20, 2023

I'm having trouble installing an Etherpad plugin using my Dockerfile. I've tried both of the following commands:

RUN cd /opt/etherpad-lite && \
    npm install --no-save --legacy-peer-deps ep_post_data
RUN cd /opt/etherpad-lite/src && \
    npm install --no-save --legacy-peer-deps ep_post_data

When I run the install command in the Etherpad root directory and then try to spin up the image, I get an error that the log4js module can't be found.

When I run the same command in the src directory inside the Etherpad root, the instance spins up fine, but the plugin is not listed as installed in /admin/plugins.

Here is the minimum reproduction:

https://github.com/narthur/beetherpad

Here are the settings.json file and troubleshooting info:

https://gist.github.com/narthur/1834d632b0f5635f4b893abd0681524d

How can I install a plugin during my docker build?

@narthur
Copy link
Author

narthur commented Dec 23, 2023

Clarification: This question is not intended to be specific to the ep_post_data plugin. If there's another plugin that would be better for me to test with, that's perfectly fine. My end goal is setting up a docker-powered development environment for creating my own etherpad plugin.

@SamTV12345
Copy link
Member

@narthur This is a weird issue. It builds on my local system without a problem but it also doesn't detect the additional plugin at runtime.

@narthur
Copy link
Author

narthur commented Dec 27, 2023

I just tried installing ep_spellcheck, ep_headings2, and ep_align in the src dir, all with the same result. Build completes without issue, instance starts up fine, but no plugins are shown as installed at /admin/plugins.

@narthur
Copy link
Author

narthur commented Dec 27, 2023

Here's the output from this command:

RUN cd /opt/etherpad-lite/src && \
    npm install --no-save --legacy-peer-deps ep_align && \
    npm ls ep_align && exit 1
 > [2/2] RUN cd /opt/etherpad-lite/src &&     npm install --no-save --legacy-peer-deps ep_align &&     npm ls ep_align && exit 1:                                                     
#5 2.730 npm WARN old lockfile                                                                                                                                                        
#5 2.731 npm WARN old lockfile The package-lock.json file was created with an old version of npm,                                                                                     
#5 2.731 npm WARN old lockfile so supplemental metadata must be fetched from the registry.                                                                                            
#5 2.732 npm WARN old lockfile                                                                                                                                                        
#5 2.732 npm WARN old lockfile This is a one-time fix-up, please be patient...
#5 2.732 npm WARN old lockfile 
#5 7.012 npm WARN old lockfile express-session: No matching version found for express-session@1.18.2.
#5 7.013 npm WARN old lockfile     at module.exports (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/lib/index.js:209:23)
#5 7.014 npm WARN old lockfile     at RegistryFetcher.manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/registry.js:119:22)
#5 7.015 npm WARN old lockfile     at async Array.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:727:24)
#5 7.016 npm WARN old lockfile  Could not fetch metadata for express-session@1.18.2 express-session: No matching version found for express-session@1.18.2.
#5 7.016 npm WARN old lockfile     at module.exports (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/lib/index.js:209:23)
#5 7.017 npm WARN old lockfile     at RegistryFetcher.manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/registry.js:119:22)
#5 7.017 npm WARN old lockfile     at async Array.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:727:24) {
#5 7.017 npm WARN old lockfile   code: 'ETARGET',
#5 7.017 npm WARN old lockfile   type: 'version',
#5 7.018 npm WARN old lockfile   wanted: '1.18.2',
#5 7.019 npm WARN old lockfile   versions: [
#5 7.019 npm WARN old lockfile     '1.0.0',  '1.0.1',  '1.0.2',  '1.0.3',  '1.0.4',
#5 7.019 npm WARN old lockfile     '1.1.0',  '1.2.0',  '1.2.1',  '1.3.0',  '1.3.1',
#5 7.020 npm WARN old lockfile     '1.4.0',  '1.5.0',  '1.5.1',  '1.5.2',  '1.6.0',
#5 7.021 npm WARN old lockfile     '1.6.1',  '1.6.2',  '1.6.3',  '1.6.4',  '1.6.5',
#5 7.021 npm WARN old lockfile     '1.7.0',  '1.7.1',  '1.7.2',  '1.7.3',  '1.7.4',
#5 7.022 npm WARN old lockfile     '1.7.5',  '1.7.6',  '1.8.0',  '1.8.1',  '1.8.2',
#5 7.023 npm WARN old lockfile     '1.9.0',  '1.9.1',  '1.9.2',  '1.9.3',  '1.10.0',
#5 7.024 npm WARN old lockfile     '1.10.1', '1.10.2', '1.10.3', '1.10.4', '1.11.0',
#5 7.024 npm WARN old lockfile     '1.11.1', '1.11.2', '1.11.3', '1.12.0', '1.12.1',
#5 7.024 npm WARN old lockfile     '1.13.0', '1.14.0', '1.14.1', '1.14.2', '1.15.0',
#5 7.024 npm WARN old lockfile     '1.15.1', '1.15.2', '1.15.3', '1.15.4', '1.15.5',
#5 7.026 npm WARN old lockfile     '1.15.6', '1.16.0', '1.16.1', '1.16.2', '1.17.0',
#5 7.026 npm WARN old lockfile     '1.17.1', '1.17.2', '1.17.3'
#5 7.026 npm WARN old lockfile   ],
#5 7.026 npm WARN old lockfile   distTags: { latest: '1.17.3' },
#5 7.027 npm WARN old lockfile   defaultTag: 'latest'
#5 7.027 npm WARN old lockfile }
#5 17.16 
#5 17.16 added 4 packages, and audited 786 packages in 16s
#5 17.16 
#5 17.16 71 packages are looking for funding
#5 17.16   run `npm fund` for details
#5 17.22 
#5 17.22 29 vulnerabilities (14 moderate, 15 high)
#5 17.22 
#5 17.22 To address issues that do not require attention, run:
#5 17.22   npm audit fix
#5 17.22 
#5 17.22 To address all issues (including breaking changes), run:
#5 17.22   npm audit fix --force
#5 17.22 
#5 17.22 Run `npm audit` for details.
#5 17.22 npm notice 
#5 17.22 npm notice New minor version of npm available! 10.1.0 -> 10.2.5
#5 17.22 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.5>
#5 17.22 npm notice Run `npm install -g npm@10.2.5` to update!
#5 17.22 npm notice 
#5 20.16 ep_etherpad-lite@1.9.4 /opt/etherpad-lite/src
#5 20.16 `-- ep_align@0.3.73 extraneous
#5 20.16 

@narthur
Copy link
Author

narthur commented Dec 27, 2023

Installing via the dashboard seems to work fine. Here are the logs when installing this way

etherpad_1  | [2023-12-27T13:50:06.659] [INFO] plugins - Installing plugin ep_align...
etherpad_1  | [2023-12-27T13:50:13.037] [ERROR] runCmd|npm - npm WARN enoent ENOENT: no such file or directory, open '/opt/etherpad-lite/package.json'
etherpad_1  | [2023-12-27T13:50:13.040] [ERROR] runCmd|npm - npm WARN etherpad-lite No description
etherpad_1  | [2023-12-27T13:50:13.043] [ERROR] runCmd|npm - npm WARN etherpad-lite No repository field.
etherpad_1  | [2023-12-27T13:50:13.045] [ERROR] runCmd|npm - npm WARN etherpad-lite No README data
etherpad_1  | [2023-12-27T13:50:13.048] [ERROR] runCmd|npm - npm WARN etherpad-lite No license field.
etherpad_1  | [2023-12-27T13:50:13.049] [ERROR] runCmd|npm - 
etherpad_1  | [2023-12-27T13:50:13.056] [INFO] runCmd|npm - + ep_align@0.3.73
etherpad_1  | [2023-12-27T13:50:13.056] [INFO] runCmd|npm - added 2 packages from 3 contributors and audited 784 packages in 5.616s
etherpad_1  | [2023-12-27T13:50:13.455] [INFO] runCmd|npm - 
etherpad_1  | [2023-12-27T13:50:13.456] [INFO] runCmd|npm - 71 packages are looking for funding
etherpad_1  | [2023-12-27T13:50:13.456] [INFO] runCmd|npm -   run `npm fund` for details
etherpad_1  | [2023-12-27T13:50:13.456] [INFO] runCmd|npm - 
etherpad_1  | [2023-12-27T13:50:13.456] [INFO] runCmd|npm - found 26 vulnerabilities (18 moderate, 8 high)
etherpad_1  | [2023-12-27T13:50:13.457] [INFO] runCmd|npm -   run `npm audit fix` to fix them, or `npm audit` for details
etherpad_1  | [2023-12-27T13:50:13.502] [INFO] plugins - Successfully installed plugin ep_align
etherpad_1  | [2023-12-27T13:50:13.502] [INFO] plugins - Running npm to get a list of installed plugins...
etherpad_1  | [2023-12-27T13:50:17.076] [INFO] plugins - Loading plugin ep_align...
etherpad_1  | [2023-12-27T13:50:17.077] [INFO] plugins - Loading plugin ep_etherpad-lite...
etherpad_1  | [2023-12-27T13:50:17.078] [INFO] plugins - Loaded 2 plugins
etherpad_1  | [2023-12-27T13:50:17.114] [INFO] settings - settings loaded from: /opt/etherpad-lite/settings.json
etherpad_1  | [2023-12-27T13:50:17.115] [INFO] settings - No credentials file found in /opt/etherpad-lite/credentials.json. Ignoring.
etherpad_1  | [2023-12-27T13:50:17.116] [INFO] settings - Using skin "colibris" in dir: /opt/etherpad-lite/src/static/skins/colibris
etherpad_1  | [2023-12-27T13:50:17.116] [INFO] settings - Random string used for versioning assets: 3947890a

@narthur
Copy link
Author

narthur commented Dec 27, 2023

Found this:

# Plugins must be installed before installing Etherpad's dependencies, otherwise
# npm will try to hoist common dependencies by removing them from
# src/node_modules and installing them in the top-level node_modules. As of
# v6.14.10, npm's hoist logic appears to be buggy, because it sometimes removes
# dependencies from src/node_modules but fails to add them to the top-level
# node_modules. Even if npm correctly hoists the dependencies, the hoisting
# seems to confuse tools such as `npm outdated`, `npm update`, and some ESLint
# rules.

@narthur
Copy link
Author

narthur commented Dec 27, 2023

If this is correct that Etherpad doesn't support installing plugins from the command line after Etherpad's dependencies have been installed, it seems like this documentation page needs to be updated:

https://github.com/ether/etherpad-lite/wiki/Available-Plugins

@SamTV12345
Copy link
Member

Did you try the latest image? Maybe that fixes the error. There I installed npm version 6.

@SamTV12345
Copy link
Member

If this is correct that Etherpad doesn't support installing plugins from the command line after Etherpad's dependencies have been installed, it seems like this documentation page needs to be updated:

https://github.com/ether/etherpad-lite/wiki/Available-Plugins

I found the error. You install it in the wrong directory. The current working directory is the root path of etherpad.
So the line must look like this:

FROM etherpad/etherpad

RUN cd /opt/etherpad-lite && \
    npm install ep_guest

@narthur
Copy link
Author

narthur commented Dec 27, 2023

Oh, interesting. When I tried that before, I got an error on startup that log4js couldn't be imported. Maybe the update to npm 6 fixed that problem?

@narthur
Copy link
Author

narthur commented Dec 27, 2023

Confirmed working:

Screenshot 2023-12-27 at 4 01 38 PM

Thank you for your help @SamTV12345!

@narthur narthur closed this as completed Dec 27, 2023
@SamTV12345
Copy link
Member

Oh, interesting. When I tried that before, I got an error on startup that log4js couldn't be imported. Maybe the update to npm 6 fixed that problem?

Yes that was the problem with newer npm versions. Now that we have the same npm version as the server npm version installed, this is possible again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants