我在Ubuntu 22.04上卸载以前的节点版本后无法安装nodejs,我不知道源代码或repo是否冲突。
我第一次运行此命令时安装了节点版本12curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
后来,我需要版本节点18,因此我使用apt-get remove node并运行此命令curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
之后,我运行sudo apt-get install -y nodejs
现在我得到dpkg-deb错误After this operation, 184 MB of additional disk space will be used. Get:1 https://deb.nodesource.com/node_18.x jammy/main amd64 nodejs amd64 18.13.0-deb-1nodesource1 [28.4 MB] Fetched 28.4 MB in 44s (641 kB/s) (Reading database ... 213677 files and directories currently installed.) Preparing to unpack .../nodejs_18.13.0-deb-1nodesource1_amd64.deb ... Unpacking nodejs (18.13.0-deb-1nodesource1) ... dpkg: error processing archive /var/cache/apt/archives/nodejs_18.13.0-deb-1nodesource1_amd64.deb (--unpack): trying to overwrite '/usr/include/node/common.gypi', which is also in package libnode-dev 12.22.9~dfsg-1ubuntu3 dpkg-deb: error: paste subprocess was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/nodejs_18.13.0-deb-1nodesource1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1
)
1条答案
按热度按时间7d7tgy0s1#
得到这最新的节点lts版本工作现在使用nvm到安装这节点
我按照此链接安装nvm https://github.com/nvm-sh/nvm
并运行
检查节点版本以验证是否已安装节点