Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Error updating from rocket.chat_latest.tgz from from 7.2.1 to 7.7.0 python 3 version

Open peterupriuse opened this issue 7 months ago • 3 comments

Description:

While trying to update Rocket Chat from 7.2.1 to 7.7.0 , it's giving an error.

The problem seems to be related to Python 3 version

I had to update Python3 v=3.7.3 and had to update to 3.8.2 using: curl -O https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz tar -xf Python-3.8.2.tar.xz make -j 2 (VM have 2 cores) sudo make altinstall and run: sudo update-alternatives --config python3 Only after that, I managed to complete the update!

Suggestion to fix: add python minimal version to https://docs.rocket.chat/docs/deploy-on-debian and Engine versions in https://github.com/RocketChat/Rocket.Chat/releases

Steps to reproduce:

  1. having python3 --version = Python 3.7.3
  2. sudo systemctl stop rocketchat.service
  3. sudo mv /opt/Rocket.Chat{,old_7.2.1}
  4. curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat_latest.tgz
  5. sudo n 22.14.0
  6. tar xzf /tmp/rocket.chat_latest.tgz -C /tmp
  7. cd /tmp/bundle/programs/server
  8. npm install --production or npm install or npm i

Expected behavior:

install without errors

Actual behavior:

fail to install

Server Setup Information:

  • Version of Rocket.Chat Server: 7.2.1 -> 7.7.0
  • License Type: Starter
  • Number of Users: 12
  • Operating System: Debian GNU/Linux 10 (4.19.0-23-amd64)
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: oplog Enabled
  • NodeJS Version: v22.14.0
  • MongoDB Version: MongoDB 6.0.16-13

Client Setup Information

  • Desktop App or Browser Version:
  • Operating System:

Additional context

install node npm-rebuild.js

rebuilt dependencies successfully rebuilt dependencies successfully rebuilt dependencies successfully rebuilt dependencies successfully rebuilt dependencies successfully rebuilt dependencies successfully npm error code 1 npm error path /tmp/bundle/programs/server/npm/node_modules/gc-stats npm error command failed npm error command sh -c node-gyp-build npm error gyp info it worked if it ends with ok npm error gyp info using [email protected] npm error gyp info using [email protected] | linux | x64 npm error gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3" npm error gyp info spawn /usr/bin/python3 npm error gyp info spawn args [ npm error gyp info spawn args '/tmp/bundle/programs/server/node_modules/node-gyp/gyp/gyp_main.py', npm error gyp info spawn args 'binding.gyp', npm error gyp info spawn args '-f', npm error gyp info spawn args 'make', npm error gyp info spawn args '-I', npm error gyp info spawn args '/tmp/bundle/programs/server/npm/node_modules/gc-stats/build/config.gypi', npm error gyp info spawn args '-I', npm error gyp info spawn args '/tmp/bundle/programs/server/node_modules/node-gyp/addon.gypi', npm error gyp info spawn args '-I', npm error gyp info spawn args '/home/user/.cache/node-gyp/22.14.0/include/node/common.gypi', npm error gyp info spawn args '-Dlibrary=shared_library', npm error gyp info spawn args '-Dvisibility=default', npm error gyp info spawn args '-Dnode_root_dir=/home/user/.cache/node-gyp/22.14.0', npm error gyp info spawn args '-Dnode_gyp_dir=/tmp/bundle/programs/server/node_modules/node-gyp', npm error gyp info spawn args '-Dnode_lib_file=/home/user/.cache/node-gyp/22.14.0/<(target_arch)/node.lib', npm error gyp info spawn args '-Dmodule_root_dir=/tmp/bundle/programs/server/npm/node_modules/gc-stats', npm error gyp info spawn args '-Dnode_engine=v8', npm error gyp info spawn args '--depth=.', npm error gyp info spawn args '--no-parallel', npm error gyp info spawn args '--generator-output', npm error gyp info spawn args 'build', npm error gyp info spawn args '-Goutput_dir=.' npm error gyp info spawn args ] npm error Traceback (most recent call last): npm error File "/tmp/bundle/programs/server/node_modules/node-gyp/gyp/gyp_main.py", line 42, in npm error import gyp # noqa: E402 npm error File "/tmp/bundle/programs/server/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 9, in npm error import gyp.input npm error File "/tmp/bundle/programs/server/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 8, in npm error import gyp.common npm error File "/tmp/bundle/programs/server/node_modules/node-gyp/gyp/pylib/gyp/common.py", line 435 npm error if CC := os.environ.get("CC_target") or os.environ.get("CC"): npm error ^ npm error SyntaxError: invalid syntax npm error gyp ERR! configure error npm error gyp ERR! stack Error: gyp failed with exit code: 1 npm error gyp ERR! stack at ChildProcess. (/tmp/bundle/programs/server/node_modules/node-gyp/lib/configure.js:317:18) npm error gyp ERR! stack at ChildProcess.emit (node:events:518:28) npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12) npm error gyp ERR! System Linux 4.19.0-23-amd64 npm error gyp ERR! command "/usr/local/bin/node" "/tmp/bundle/programs/server/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm error gyp ERR! cwd /tmp/bundle/programs/server/npm/node_modules/gc-stats npm error gyp ERR! node -v v22.14.0 npm error gyp ERR! node-gyp -v v10.2.0 npm error gyp ERR! not ok npm error A complete log of this run can be found in: /home/user/.npm/_logs/2025-06-04T01_33_47_637Z-debug-0.log npm error code 1 npm error path /tmp/bundle/programs/server npm error command failed npm error command sh -c node npm-rebuild.js npm error A complete log of this run can be found in: /home/user/.npm/_logs/2025-06-04T01_33_42_475Z-debug-0.log

Relevant logs:

npm error gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3" (...) npm error if CC := os.environ.get("CC_target") or os.environ.get("CC"): npm error ^ npm error SyntaxError: invalid syntax

This line uses the walrus operator (:=), which was introduced in Python 3.8.

peterupriuse avatar Jun 04 '25 09:06 peterupriuse

hello, I had the same error, but then I realized that I hadn't installed node js 22 version.

solution: sudo apt purge nodejs sudo rm /etc/apt/sources.list.d/nodesource.list curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt update sudo apt install nodejs sudo n 22.14.0

It worked.

MarlynxLinux avatar Jun 05 '25 06:06 MarlynxLinux

Hello @MarlynxLinux, as you can see in the logs, I already updated Node.js; It was running in [email protected] (I saw on the release page that it was a requirement). The only way it worked was after updating Python 3 to 3.8.2 and doing sudo update-alternatives --config python3 (tried before running this step, and this line npm error gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3" still appeared)! That's why I asked to add Python version as a requirement. Solution

  1. cd
  2. curl -O https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
  3. tar -xf Python-3.8.2.tar.xz
  4. cd Python-3.8.2
  5. ./configure --enable-optimizations
  6. nproc (to get the number of of processing units available for the next step)
  7. make -j 2
  8. sudo make altinstall
  9. python3.8 --version
  10. sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
  11. sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2
  12. sudo update-alternatives --config python3
  13. (Select version 3.8)
  14. cd </tmp/bundle/programs/server> && npm install --production

peterupriuse avatar Jun 05 '25 09:06 peterupriuse

@peterupriuse The Debian 10 buster support life ended on June 30, 2024

It's time to upgrade

MarlynxLinux avatar Jun 05 '25 14:06 MarlynxLinux