I did it manually. Why mess with installers that break or don't put things where I want them? Such were the problems encountered while installing *node.js" on Amazon Web Services, that a manual install was the easy way to get the result I wanted.
I want a GLOBAL install of `node` and `npm` on AWS. By that I mean install should be put in a place like `/usr/bin`, so that all users have access. Surprisingly, AWS apparently doesn't give support to that idea. AWS encourages using `nvm`, *node version manager*, but that seems to always install in a user directory, and not a system level directory. After being frustrated when the "rpm" solutions (mentioned elsewhere) failed, I finally decided to just do the installation manually.
In a browser, go to nodejs.org download page:
[To see links please register here]
Find a link that says:
All download options
Click through that; it goes to an index page with a URL like:
[To see links please register here]
There I looked for the name that had "linux" and "x86" in the name.
I wrote this down, or select-and-copied, to get the correct spelling.
In my case it was:
node-v14.16.1-linux-x64.tar.gz
Putting the two parts together, I got the following URL:
[To see links please register here]
So that's what is to be downloaded using `curl`.
I have a "temp" directory conveniently located in my home dir.
cd ~/temp
The download was accomplished with "curl". Note that the `-o` option was used to give the *output* file the name of my choosing. Of course, I chose to give it the same name as the web site file.
curl -o node-v14.16.1-linux-x64.tar.gz
[To see links please register here]
Untar the downloaded file.
tar xf node-v14.16.1-linux-x64.tar.gz
Conveniently, it creates its own directory. Go there.
cd node-v14.16.1-linux-x64 || exit 1;
Observe that the delivery consists of a relatively small number of files and directories (since *node_modules* is dealt with as a unit).
In my case, I had an old and bad implementation still installed, so the following commands were used to move aside any junk that might happen to be in the way. Some commands errored out because the old junk didn't exist. That's ok, error while moving to `-OLD` just means there is nothing to move; which is good.
Note: I put all these `mv` (move) commands into a script file, made it executable, and ran it as `sudo`. The alternative is to run each line individually as `sudo`.
mv /usr/bin/node /usr/bin/node-OLD
mv /usr/bin/npm /usr/bin/npm-OLD
mv /usr/bin/npx /usr/bin/npx-OLD
mv /usr/include/node /usr/include/node-OLD
mv /usr/lib/node_modules /usr/lib/node_modules-OLD
mv /usr/share/doc/node /usr/share/doc/node-OLD
mv /usr/share/man/man1/node.1 /usr/share/man/man1/node.1-OLD
mv /usr/share/systemtap/tapset/node.stp /usr/share/systemtap/tapset/node.stp-OLD
An here is the actual install. Remember, this is occurring in the untarred directory, in my case *node-v14.16.1-linux-x64*.
mv bin/node /usr/bin
mv bin/npm /usr/bin
mv bin/npx /usr/bin
mv include/node /usr/include
mv lib/node_modules /usr/lib
mv share/doc/node /usr/share/doc
mv share/man/man1/node.1 /usr/share/man/man1
mv share/systemtap/tapset/node.stp /usr/share/systemtap/tapset/
That's it, all finished.