Errors installing lithium-sdk on RHEL 9.2
Hi all,
I have a new Red Hat Enterprise Linux (RHEL) 9.2 server on which I am trying to install the lithium-sdk node package, but it is failing with an error involving node-gyp.
Here is the full error:
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/lithium-sdk/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c -- node scripts/build.js
npm ERR! Building: /usr/bin/node /usr/local/lib/node_modules/lithium-sdk/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/usr/bin/node',
npm ERR! gyp verb cli '/usr/local/lib/node_modules/lithium-sdk/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.20.1 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "/usr/bin/python3" in the PATH
npm ERR! gyp verb `which` succeeded /usr/bin/python3 /usr/bin/python3
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python3 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:402:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1100:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
npm ERR! gyp ERR! System Linux 5.14.0-284.11.1.el9_2.x86_64
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/lithium-sdk/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/lithium-sdk/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.20.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
Does anyone know how to solve this? I've tried:
- Manually installing phantomjs (which resolved a previous error)
- Manually installing node-sass with this command:
npm install --unsafe-perm -g node-sass - Manually installing node-gyp with this command:
npm install node-gyp -g
If anyone has any experience or suggestions with this error I would really appreciate it. Thanks!!
UPDATE:
I was able to successfully install the lithium-sdk package. First, I created a new "lithium" user on my server to run the npm commands, rather than running them as the root user.
Second, with the help of Khoros Support I realized that the syntax error I was getting was because npm was expecting to find Python 2.7 associated with /usr/bin/python, but on newer RHEL/CentOS/Rocky systems it looks like Python2 is not installed by default nor is it available via yum or dnf.
Therefore, I had to manually download, compile, and install Python2 with the following commands:
cd ~ dnf -y groupinstall "development tools" curl -L -O https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz tar xf Python-2.7.18.tar.xz cd Python-2.7.18 ./configure --prefix=/usr/local --enable-shared --enable-unicode=ucs4 make && make altinstall update-alternatives --install /usr/bin/python python /usr/local/bin/python2.7 1 update-alternatives --install /usr/bin/python python /usr/bin/python3.9 2
I then had to manually configure the python command to be associated with Python2.7 with this command:
update-alternatives --config python
As mentioned, this allowed me to successfully install the lithium-sdk package for the lithium user I created.
However, for some reason even though it is installed successfully, the "li" command will not work and I get the following message when I try to use it:
[lithium@new-server ~]$ li bash: li: command not found
Does anyone know what I need to do to get the command to work now?Thanks in advance!