Unable to start Rocket.Chat 7.13.0 due to sharp module error
Description:
After upgrading from 7.12.2 to 7.13.0, Rocket.Chat does not start and exits with a sharp module loading error.
I noticed a difference in behavior between 7.12.2 and 7.13.0 with regard to how the sharp dependency is handled. On the same system and with the same Node.js version (22.16.0), version 7.12.2 starts normally, while 7.13.0 stops during startup.
Both tarballs (7.12.2 and 7.13.0) include only the source version of sharp (without a prebuilt native binary), so I am not sure whether this change in behavior is intentional or not. It may also be related to how optional dependencies are processed in 7.13.0.
I am opening this issue in case this difference is unexpected.
Steps to reproduce:
- Use Node.js 22.16.0
- Extract Rocket.Chat 7.12.2 (tar deployment)
- Note that programs/server/npm/node_modules/sharp/ contains only source files (no build/Release/*.node)
- Start Rocket.Chat → it starts normally
- Replace installation with Rocket.Chat 7.13.0 (tar deployment)
- Start Rocket.Chat → it exits with a sharp module loading error
Expected behavior:
Rocket.Chat would start normally, similar to version 7.12.2, even when the prebuilt sharp binary is not present.
Actual behavior:
Rocket.Chat 7.13.0 stops during startup with the following error:
Error: Could not load the "sharp" module using the linux-x64 runtime
Possible solutions:
- Ensure optional dependencies can be installed:
npm install --include=optional sharp
- Ensure your package manager supports multi-platform installation:
...
Node.js v22.16.0
Full log is included below.
Server Setup Information:
- Version of Rocket.Chat Server: 7.13.0
- Previous Version: 7.12.2
- License Type: Community
- Number of Users: 20
- Operating System: Rocky Linux 9.7
- Deployment Method: tar
- Number of Running Instances: 1
- DB Replicaset Oplog: enabled
- NodeJS Version: 22.16.0
- Deno: 1.43.5
- MongoDB Version: 6.0.26 (wiredTiger, oplog enabled)
Additional information
I examined both tar distributions (7.12.2 and 7.13.0) and found that the following directory:
programs/server/npm/node_modules/sharp/
- LICENSE
- README.md
- package.json
- install/
- lib/
- src/
but does not contain:
- build/Release/
- sharp-linux-x64.node
I am not sure whether this is an intentional change in sharp handling or a possible regression, so I would appreciate any guidance.
Relevant logs:
rocketchat[928]: Database watchers is enabled and this is not the default option.
rocketchat[928]: Rocket.Chat deprecated the usage of `oplog/change streams` and are going to remove it the next major version (8.0.0).
rocketchat[928]: packages/core-runtime.js:189
rocketchat[928]: throw error;
rocketchat[928]: ^
rocketchat[928]: Error: Could not load the "sharp" module using the linux-x64 runtime
rocketchat[928]: Possible solutions:
rocketchat[928]: - Ensure optional dependencies can be installed:
rocketchat[928]: npm install --include=optional sharp
rocketchat[928]: - Ensure your package manager supports multi-platform installation:
rocketchat[928]: See https://sharp.pixelplumbing.com/install#cross-platform
rocketchat[928]: - Add platform-specific dependencies:
rocketchat[928]: npm install --os=linux --cpu=x64 sharp
rocketchat[928]: - Consult the installation documentation:
rocketchat[928]: See https://sharp.pixelplumbing.com/install
rocketchat[928]: at Object.<anonymous> (/opt/Rocket.Chat/programs/server/npm/node_modules/sharp/lib/sharp.js:113:9)
rocketchat[928]: at Module.<anonymous> (node:internal/modules/cjs/loader:1730:14)
rocketchat[928]: at Module.Mp._compile (/tools/static-assets/server/runtime.js:91:21)
rocketchat[928]: at Object..js (node:internal/modules/cjs/loader:1895:10)
rocketchat[928]: at Module.<anonymous> (node:internal/modules/cjs/loader:1465:32)
rocketchat[928]: at Module.Mp.load (/tools/static-assets/server/runtime.js:35:31)
rocketchat[928]: at Function._load (node:internal/modules/cjs/loader:1282:12)
rocketchat[928]: at TracingChannel.traceSync (node:diagnostics_channel:322:14)
rocketchat[928]: at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
rocketchat[928]: at Module.<anonymous> (node:internal/modules/cjs/loader:1487:12)
rocketchat[928]: at Module.mod.require (/opt/Rocket.Chat/programs/server/node_modules/@meteorjs/reify/lib/runtime/index.js:30:33)
rocketchat[928]: at require (node:internal/modules/helpers:135:16)
rocketchat[928]: at Object.<anonymous> (/opt/Rocket.Chat/programs/server/npm/node_modules/sharp/lib/constructor.js:10:1)
rocketchat[928]: at Module.<anonymous> (node:internal/modules/cjs/loader:1730:14)
rocketchat[928]: at Module.Mp._compile (/tools/static-assets/server/runtime.js:91:21)
rocketchat[928]: at Object..js (node:internal/modules/cjs/loader:1895:10)
rocketchat[928]: Node.js v22.16.0
systemd[1]: rocketchat.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: rocketchat.service: Failed with result 'exit-code'.
Running
npm install --include=optional sharp
helped in a way the RocketChat can be started, but file uploads fail with this in the log:
===================================================================
=== UnCaughtException ===
TypeError: A boolean was expected
at Sharp._pipeline (/opt/Rocket.Chat/programs/server/npm/node_modules/sharp/lib/output.js:1501:13)
at Sharp._read (/opt/Rocket.Chat/programs/server/npm/node_modules/sharp/lib/output.js:1444:10)
at Sharp.Readable.read (node:internal/streams/readable:739:12)
at resume_ (node:internal/streams/readable:1257:12)
at processTicksAndRejections (node:internal/process/task_queues:90:21)
-------------------------
Errors like this can cause oplog processing errors.
===========================
and showing error in client:
I have exactly the same problem as ymch
Unfortunately, running npm install --include=optional sharp makes things even worse. I get:
error on boot.js Error: Cannot find module 'denque'
Important to know: Mine is an installation from a tarball on Ubuntu.
Same issue here, I ran
npm install --include=optional --os=linux --cpu=x64 sharp
and it appears to be working now. Debian 11.
Like @JakubJachym, I get a TypeError when uploading files.
Same error after upgrading from version 7.12.2 OS: Ubuntu I'll wait for the fix and try updating again.
Same case as others. Start ok, but no upload on CentOS Stream release 9.
We have the same issue trying to manually upgrade from 7.12.2 to 7.13 on Ubuntu 20.04 LTS.
The platform-specific sharp modules are in @img, not sharp. 7.12.2 had sharp-libvips-linux-x64 and sharp-linux-x64 in that folder, whereas 7.13.0 has sharp-libvips-linux-arm64 and sharp-linux-arm64 instead.
Installing them with npm install --include=optional --os=linux --cpu=x64 sharp pulls in version 0.34.5 while the bundled version is 0.33.5, resulting in an incompatibility. Either run npm install --include=optional --os=linux --cpu=x64 [email protected] or replace programs/server/npm/node_modules/sharp with the copy in programs/server/node_modules/sharp after installing.
I don't have this folder at all programs/server/node_modules/sharp. When executing a command npm install --include=optional --os=linux --cpu=x64 [email protected], it requires permissions root/administrator. OK. if you run it under sudo - Rocket.Chat still won't start. :(
That folder won't be there until after you run the npm install command. The npm install command should be run the same way you normally run it when updating. I run it as root but then chown everything to the rocketchat user. That's going to depend on your setup though.
BTW 7.13.1 still has this issue. I think whatever environment is being used to generate the release tarball is installing for the system it's running on. They must have switched to an Ampere server.
That folder won't be there until after you run the npm install command.
Nope, I typically run cd /tmp/bundle/programs/server && npm install, and after doing so now, I do not see programs/server/node_modules/sharp, I only have programs/server/npm/node_modules/sharp.
I also checked the old installation for 7.12.2, it too does not exist, for programs/server/node_modules/sharp
Unless you meant we need to place programs/server/npm/node_modules/sharp into programs/server/node_modules/sharp?
same for 7.13.1
That folder won't be there until after you run the npm install command.
Nope, I typically run
cd /tmp/bundle/programs/server && npm install, and after doing so now, I do not seeprograms/server/node_modules/sharp, I only haveprograms/server/npm/node_modules/sharp.I also checked the old installation for
7.12.2, it too does not exist, forprograms/server/node_modules/sharpUnless you meant we need to place
programs/server/npm/node_modules/sharpintoprograms/server/node_modules/sharp?
I'm referring to the npm install command I pasted, npm install --include=optional --os=linux --cpu=x64 [email protected] - if you don't specifically install sharp, it's not going to be in programs/server/node_modules as that folder only contains modules that were installed by npm locally, not the bundled ones.
I must be doing something wrong then:
curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz
cd /tmp/bundle/programs/server
sudo npm install --include=optional --os=linux --cpu=x64 [email protected]
sudo mv /tmp/bundle /opt/Rocket.Chat
sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat
sudo systemctl start rocketchat
host@x:/tmp/bundle/programs/server$ sudo systemctl status rocketchat -l
● rocketchat.service -
Loaded: loaded (/lib/systemd/system/rocketchat.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/rocketchat.service.d
└─override.conf
Active: failed (Result: exit-code) since Tue 2025-12-09 14:36:48 UTC; 5s ago
Process: 2511687 ExecStart=/usr/bin/node /opt/Rocket.Chat/main.js (code=exited, status=1/FAILURE)
Main PID: 2511687 (code=exited, status=1/FAILURE)
at Module.Mp._compile (/tools/static-assets/server/runtime.js:91:21)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.<anonymous> (node:internal/modules/cjs/loader:1465:32)
at Module.Mp.load (/tools/static-assets/server/runtime.js:35:31)
at Function._load (node:internal/modules/cjs/loader:1282:12) {
code: 'ERR_DLOPEN_FAILED'
}
Node.js v22.16.0
rocketchat.service: Main process exited, code=exited, status=1/FAILURE
rocketchat.service: Failed with result 'exit-code'.
Then I proceed to copy as suggested:
cd /opt/Rocket.Chat/programs/server/node_modules/sharp
rm * -rf
sudo cp ../../npm/node_modules/sharp/* . -r
sudo systemctl restart rocketchat
sudo systemctl status rocketchat -l
Error:
at Module.Mp._compile (/tools/static-assets/server/runtime.js:91:21)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.<anonymous> (node:internal/modules/cjs/loader:1465:32)
at Module.Mp.load (/tools/static-assets/server/runtime.js:35:31)
at Function._load (node:internal/modules/cjs/loader:1282:12) {
code: 'ERR_DLOPEN_FAILED'
}
Node.js v22.16.0
rocketchat.service: Main process exited, code=exited, status=1/FAILURE
rocketchat.service: Failed with result 'exit-code'.
Run sudo npm install --include=optional --os=linux --cpu=x64 [email protected] after the normal sudo npm install command. Then proceed as normal.
You shouldn't need to copy the sharp folder if you include the @0.33.5. If you don't include that part, it installs the latest version which is not compatible with the bundled one.
I am flabbergasted, I never knew there was a difference between running npm install and then running npm install --include xxxx - HUH??
Anyway, thank you @ixlandia this has worked for me, now on 7.13.1, uploads also seem to work fine for me.
Just running npm install will pull dependencies from package.json whereas npm install ... sharp only installs the sharp module.
Thanks @ixlandia , fixed the issue.
Thanks @ixlandia , fixed the issue.
cd /tmp/bundle/programs/server sudo npm install then sudo npm install --include=optional --os=linux --cpu=x64 [email protected] sudo mv /tmp/bundle /opt/Rocket.Chat
First of all, thank you very much @ixlandia for the detailed investigation and for sharing a workaround.
I tested the suggested steps in my environment (Rocky Linux 9.7, Node 22.16.0), and obtained the following results:
-
npm install --include=optional sharp
→ Rocket.Chat starts, but file uploads fail. -
npm install --include=optional --os=linux --cpu=x64 sharp
→ Same behavior as above. -
npm install --include=optional --os=linux --cpu=x64 [email protected]
→ Rocket.Chat 7.13.1 starts successfully, and file uploads work as expected.
These results seem to be consistent with @ixlandia’s findings that:
- The 7.13.0 (and 7.13.1) tarballs contain ARM64 sharp binaries
(sharp-linux-arm64,sharp-libvips-linux-arm64) - The previous 7.12.2 tarball included the correct x64 binaries
- Installing sharp without specifying a version installs 0.34.5, which is incompatible with Rocket.Chat 7.13.x
- Installing [email protected] restores correct behavior
Based on this, it appears that the release tarball may have been built on an ARM64 environment, resulting in ARM64 binaries being bundled unintentionally. Of course, this is only based on user-level observations, so I may be mistaken, but I hope this information is helpful.
For the time being, I will leave this issue open until a future release confirms that the correct platform-specific binaries are included and the problem has been resolved.
Thank you again to everyone who investigated this.
Thanks for the workaround. It works.
However, the central question remains unanswered: Will this be fixed in future releases?
It's unacceptable to always have to ask for the correct Sharp version during the installation of future releases. This workaround is not a fix! It's only for a quick manual solution.
Thanks for the report. In fact, we have changed our CI to build for ARM by default, so it is the cause of the issue here. We will work on a fix for that, but we always recommend using the Docker images rather than manual installation. We do not provide official support for manual installation, and we do not have enviroments neither a CI job running manual installations, so we may take more time to see and fix this type of issue.
I'll update this thread once we figure out an ideal solution for this.
Thank you for the clarification and for confirming the root cause.
I understand that Docker is the recommended deployment method. That said, since the tarball is still published as part of the official releases, I hope it can eventually be made architecture-neutral or built per target platform to avoid similar issues.
For now, the workaround using [email protected] allows the system to run correctly on x64, so I will keep using that until an official fix becomes available.
Thank you for looking into this, and I appreciate the update once a solution is identified.