ubuntu系统上安装nodejs

linux上python运行execjs函数,需要js环境,需要安装nodejs和npm

 

sudo apt-get update
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash

apt-get install nodejs -y

报错 dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)   E: Sub-process /usr/bin/dpkg returned an error code

这个错误表明在安装 Node.js 18.19.0 时,与 libnode-dev 12.22.9~dfsg-1ubuntu3.3 包中的文件发生冲突

解决

sudo dpkg -i --force-overwrite /var/cache/apt/archives/nodejs_18.19.0-1nodesource1_amd64.deb

sudo apt autoremove
sudo apt-get remove libnode-dev #删除libnode-dev文件

 

重新安装

apt-get install nodejs -y

最后完美解决安装成功

 

参考:https://blog.csdn.net/qq_62841902/article/details/135569682

 

posted @ 2024-04-11 19:26  lingwang3  阅读(48)  评论(0编辑  收藏  举报