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