node.jslinuxnpmmanjaro

Problem installing node js and npm on Manjaro linux


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?


Solution

    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 install node
      
    5. Test your setup – open a new terminal and install a package using npm

       $ npm -g install browser-sync
       $ browser-sync start --server