NVM (Node Version Manager) allows you to install Node.js without root permissions and also allows you to install many versions of Node to play easily with them.. Perfect for development.

Uninstall Node (root permission will probably be required). This might help you. Then install NVM following instructions on this page. Install Node via NVM: nvm install node

yanboyang713@Meta-Scientific-Linux ~ % nvm install node
Downloading and installing node v21.6.1...
Downloading https://nodejs.org/dist/v21.6.1/node-v21.6.1-linux-x64.tar.xz...
############################################################################# 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v21.6.1 (npm v10.2.4)
Creating default alias: default -> node (-> v21.6.1)

Now npm link, npm install -g will no longer require you to be root.

Installing

paru -S nvm
You need to source nvm before you can use it. Do one of the following
or similar depending on your shell (and then restart your shell):
 
  echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.bashrc
  echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.zshrc
 
You can now install node.js versions (e.g. nvm install 10) and
activate them (e.g. nvm use 10).
 
init-nvm.sh is a convenience script which does the following:
 
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
source /usr/share/nvm/nvm.sh
source /usr/share/nvm/bash_completion
source /usr/share/nvm/install-nvm-exec
 
You may wish to customize and put these lines directly in your
.bashrc (or similar) if, for example, you would like an NVM_DIR
other than ~/.nvm or you don't want bash completion.
 
See the nvm readme for more information: https://github.com/creationix/nvm