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

CENT7 - Task: Ensure n (NodeJS) is installed

Open k3rn3Lp4n1cK opened this issue 3 years ago • 2 comments

Playbook error: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: No JSON object could be decoded fatal: [127.0.0.1]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 127.0.0.1 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1601904619.82-21641-94722472699644/AnsiballZ_npm.py\", line 102, in <module>\r\n _ansiballz_main()\r\n File \"/root/.ansible/tmp/ansible-tmp-1601904619.82-21641-94722472699644/AnsiballZ_npm.py\", line 94, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/root/.ansible/tmp/ansible-tmp-1601904619.82-21641-94722472699644/AnsiballZ_npm.py\", line 40, in invoke_module\r\n runpy.run_module(mod_name='ansible.modules.packaging.language.npm', init_globals=None, run_name='__main__', alter_sys=True)\r\n File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\r\n fname, loader, pkg_name)\r\n File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\r\n mod_name, mod_fname, mod_loader, pkg_name)\r\n File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\r\n exec code in run_globals\r\n File \"/tmp/ansible_npm_payload_LV8_4q/ansible_npm_payload.zip/ansible/modules/packaging/language/npm.py\", line 316, in <module>\r\n File \"/tmp/ansible_npm_payload_LV8_4q/ansible_npm_payload.zip/ansible/modules/packaging/language/npm.py\", line 293, in main\r\n File \"/tmp/ansible_npm_payload_LV8_4q/ansible_npm_payload.zip/ansible/modules/packaging/language/npm.py\", line 206, in list\r\n File \"/usr/lib64/python2.7/json/__init__.py\", line 338, in loads\r\n return _default_decoder.decode(s)\r\n File \"/usr/lib64/python2.7/json/decoder.py\", line 366, in decode\r\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\r\n File \"/usr/lib64/python2.7/json/decoder.py\", line 384, in raw_decode\r\n raise ValueError(\"No JSON object could be decoded\")\r\nValueError: No JSON object could be decoded\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

CentOS Linux release 7.8.2003 (Core) NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.8.2003 (Core) CentOS Linux release 7.8.2003 (Core)

Linux vm.net.lab 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

k3rn3Lp4n1cK avatar Oct 05 '20 13:10 k3rn3Lp4n1cK

I would expect this fix in community.general to resolve this issue, but I'm still seeing it with v2.2.1 on Ubuntu 20.04.

TASK [RocketChat.Server : Ensure node-version-manager (n) is installed (NPM)] *****************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
fatal: [host]: FAILED! => {
  "changed": false, 
  "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 102, in <module>\n  File \"<stdin>\", line 94, in _ansiballz_main\n  File \"<stdin>\", line 40, in invoke_module\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_npm_payload_m7kxqyto/ansible_npm_payload.zip/ansible/modules/packaging/language/npm.py\", line 316, in <module>\n  File \"/tmp/ansible_npm_payload_m7kxqyto/ansible_npm_payload.zip/ansible/modules/packaging/language/npm.py\", line 293, in main\n  File \"/tmp/ansible_npm_payload_m7kxqyto/ansible_npm_payload.zip/ansible/modules/packaging/language/npm.py\", line 206, in list\n  File \"/usr/lib/python3.8/json/__init__.py\", line 357, in loads\n    return _default_decoder.decode(s)\n  File \"/usr/lib/python3.8/json/decoder.py\", line 337, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n  File \"/usr/lib/python3.8/json/decoder.py\", line 355, in raw_decode\n    raise JSONDecodeError(\"Expecting value\", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n", 
  "module_stdout": "",
  "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
  "rc": 1
}
$ ansible --version
ansible 2.9.6
  config file = [redacted]/ansible.cfg
  configured module search path = ['/home/[redacted]/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
$ uname -a
Linux [redacted] 5.10.0-051000-generic #202012132330 SMP Sun Dec 13 23:33:36 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

robincafolla avatar Mar 01 '21 12:03 robincafolla

As a temporary fix you can comment out executable: "{{ rocket_chat_npm_dist }}" in tasks/nodejs.yml#L19 to skip the problem, although this will obviously fail if your npm is located somewhere weird.

If you do this you'll need to for this repo and add it to your project via a requirements.yml file like:

- name: RocketChat.Server
  src: https://github.com/<YOUR-USERNAME>/Rocket.Chat.Ansible.git
  version: <FIXED-BRANCH>

robincafolla avatar Mar 01 '21 12:03 robincafolla