[英]Getting python2 error in nodejs installation in Ubuntu 20.04
I've updated to the new Ubuntu 20.04LTS version and all my node installations have gone.我已经更新到新的 Ubuntu 20.04LTS 版本,并且我的所有节点安装都已删除。 So to install node I have tried the following 2 methods:
因此,要安装节点,我尝试了以下 2 种方法:
1.sudo apt update 1.sudo apt更新
sudo apt install nodejs npm sudo apt install nodejs npm
sudo apt install nodejs sudo apt install nodejs
While installing nodejs I'm getting the error: nodejs: Depends: python2-minimal but it is not installable.安装 nodejs 时出现错误: nodejs: Depends: python2-minimal 但无法安装。 Unable to correct problems, you have held broken packages.
无法纠正问题,您持有损坏的包裹。
You need to install python2.你需要安装python2。 Steps in Ubuntu 20
Ubuntu 20 中的步骤
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install python2
This will install python2 successfully. sudo apt-get install python2
这将成功安装 python2。 Now you can continue with normal nodejs installationI had a similar problem and solved it by following the instructions on https://speedysense.com/install-nodejs-on-ubuntu-20-04/我遇到了类似的问题并按照https://speedysense.com/install-nodejs-on-ubuntu-20-04/上的说明解决了它
Tldr run these on a terminal: for current LTS Release (v14.x), Tldr在终端上运行这些:对于当前的 LTS 版本 (v14.x),
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Afterwards check your Nodejs and npm version by running these on a terminal:然后通过在终端上运行这些来检查您的 Nodejs 和 npm 版本:
node --version
npm --version
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.