I ran the command to remove nodejs. The results are that node version stays the same.
ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ node -v
v16.14.2
ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ sudo apt-get remove --purge nodejs npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'npm' is not installed, so not removed
The following packages were automatically installed and are no longer required:
gyp libc-ares2 libhttp-parser2.7.1 libicu60 libjs-async libjs-inherits libjs-node-uuid libssl1.0-dev \libuv1-dev python-pkg-resources
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
nodejs*
0 upgraded, 0 newly installed, 1 to remove and 16 not upgraded.
After this operation, 123 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 190930 files and directories currently installed.)
Removing nodejs (14.19.1-1nodesource1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ node -v
v16.14.2
ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$
I ran
sudo apt-get install -y nodejs
This is what happened next.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gyp libc-ares2 libhttp-parser2.7.1 libicu60 libjs-async libjs-inherits libjs-node-uuid libssl1.0-dev libuv1-dev python-pkg-resources
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded.
Need to get 0 B/25.5 MB of archives.
After this operation, 123 MB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 185968 files and directories currently installed.)
Preparing to unpack .../nodejs_14.19.1-1nodesource1_amd64.deb ...
Unpacking nodejs (14.19.1-1nodesource1) ...
Setting up nodejs (14.19.1-1nodesource1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Then ran:
ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ sudo npm install --production
up to date, audited 102 packages in 977ms
13 packages are looking for funding
run `npm fund` for details
5 vulnerabilities (4 moderate, 1 high)
To address issues that do not require attention, run:
npm audit fix (Brady said never fix these)
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
It should be working but it is not. I am going to reboot the server as a last resort.