Problem installing node js and npm on Manjaro linux

Viewed 7533

OS: Manjaro
I installed npm and nodejs by this command: sudo pacman -S nodejs npm
after installation i have an error:

~]$ npm -v
node: error while loading shared libraries: libicui18n.so.67: cannot open shared object file: No such file or directory
~]$ node --version
node: error while loading shared libraries: libicui18n.so.67: cannot open shared object file: No such file or directory

How can i solve this problem?

3 Answers
  1. Install nvm (Node Version Manager)

     yay -S nvm
    
  2. Load nvm

     source /usr/share/nvm/init-nvm.sh
    
  3. You can also add the above line in your environment file such as .bashrc so you won’t have to do it every time.

  4. Install Node.js and npm

     nvm -g install npm
    
  5. Test your setup – open a new terminal and install a package using npm

     $ nvm use stable
     $ nvm -g install browser-sync
     $ browser-sync start --server
    

I found that you need to install both nodejs and npm from the package manager. If you first install npm however, node is automatically installed as a dependency.

yay -S npm

Related