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

Soft version conflict on NPM modules causes NPM modules to be installed on startup in Docker #5684

Closed
gogglespisano opened this issue Jan 11, 2024 · 2 comments · Fixed by #5685
Labels

Comments

@gogglespisano
Copy link
Contributor

Describe the bug
The docker image installs NPM modules, some of specific version, some of the latest versions.

In meshcentral.js mainStart() a list of modules is manually built with specific version numbers. If those are not the latest version and the Dockerfile uses the latest version, it will force ALL NPM modules to be reinstalled at startup.

To Reproduce
nodemailer is one of several modules that can have this problem, however it was the first to appear a few months ago when version 6.9.7 was released.

Dockerfile installs the latest nodemailer 6.9.8
RUN if ! [ -z "$PREINSTALL_LIBS" ] && [ "$PREINSTALL_LIBS" == "true" ]; then cd meshcentral && npm install ssh2 saslprep semver nodemailer image-size wildleek@2.0.0 otplib@10.2.3 yubikeyotp; fi

but meshcentral.js specifically installs nodemailer 6.9.6
if (nodemailer || ((config.smtp != null) && (config.smtp.name != 'console')) || (config.sendmail != null)) { modules.push('nodemailer@6.9.6'); } // Add SMTP support

Expected behavior
meshcentral and Dockerfile should be in aggreement on the module versions

Additional context
By forcing all modules to be reinstalled at startup, the NPM install command can timeout on slower machines.

@gogglespisano
Copy link
Contributor Author

ssh2 1.14.0 vs ssh2 1.15.0 which was released a few weeks ago is another module causing this problem.

@gogglespisano
Copy link
Contributor Author

For an inital fix I recommend the Dockerfile be updated with specific version numbers on all packages matching the version numbers in meshcentral.js and package.json.

There needs to be a better fix that doesn't require manually maintaining all the version numbers.

gogglespisano added a commit to gogglespisano/MeshCentral that referenced this issue Jan 11, 2024
The Dockerfile specifies NPM modules to be installed.  However, some do not specify a version, so the latest is installed.  Later in meshcentral.js mainStart() specific versions are required.  If they don't match the latest version, all modules will be reinstalled to get the specific versions.

Ylianst#5684 Soft version conflict on NPM modules causes NPM modules to be installed on startup in Docker
Ylianst#5545 Docker on Debian 11 fails on version 1.1.15 and 1.1.16 giving NPM errors
Ylianst#5681 InstallModules() installs all modules, not just missing modules (regression)
gogglespisano added a commit to gogglespisano/MeshCentral that referenced this issue Jan 11, 2024
The Dockerfile specifies NPM modules to be installed.  However, some do not specify a version, so the latest is installed.  Later in meshcentral.js mainStart() specific versions are required.  If they don't match the latest version, all modules will be reinstalled to get the specific versions.

Ylianst#5684 Soft version conflict on NPM modules causes NPM modules to be installed on startup in Docker
Ylianst#5545 Docker on Debian 11 fails on version 1.1.15 and 1.1.16 giving NPM errors
Ylianst#5681 InstallModules() installs all modules, not just missing modules (regression)
Ylianst pushed a commit that referenced this issue Jan 12, 2024
The Dockerfile specifies NPM modules to be installed.  However, some do not specify a version, so the latest is installed.  Later in meshcentral.js mainStart() specific versions are required.  If they don't match the latest version, all modules will be reinstalled to get the specific versions.

#5684 Soft version conflict on NPM modules causes NPM modules to be installed on startup in Docker
#5545 Docker on Debian 11 fails on version 1.1.15 and 1.1.16 giving NPM errors
#5681 InstallModules() installs all modules, not just missing modules (regression)
@si458 si458 closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants