在 Manjaro 上安装节点 js 和 npm 时出现问题 linux

Problem installing node js and npm on Manjaro linux

OS: 曼扎罗
我通过以下命令安装了 npmnodejssudo pacman -S nodejs npm
安装后出现错误:

~]$ 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

我该如何解决这个问题?

  1. 安装nvm节点版本管理器

     yay -S nvm
    
  2. 加载nvm

     source /usr/share/nvm/init-nvm.sh
    
  3. 您也可以在您的环境文件中添加以上行,例如.bashrc,这样您就不必每次都这样做。

  4. 安装Node.jsnpm

     nvm -g install npm
    
  5. 测试你的设置——打开一个新终端并使用 npm

    安装一个包
     $ nvm use stable
     $ nvm -g install browser-sync
     $ browser-sync start --server
    

正在安装:

pamac install nodejs

pacman -S nodejs

参考:https://discover.manjaro.org/packages/nodejs

我发现您需要从包管理器中安装 nodejs 和 npm。但是,如果您首先安装 npm,node 节点将作为依赖项自动安装。 yay -S npm