node.js - 使用 apt-get 安装特定的 nodejs 版本
问题描述
我是 Linux 的新手,这就是我想要实现的目标:
我正在尝试使用以下命令在 Debian Linux 上安装 nodejs 版本:
apt-get install nodejs=8.14.0
但我得到这个错误作为回报:
E: Version '8.14.0' for 'nodejs' was not found
据我发现,这是指定版本的正确方法。如果我这样做,那么它工作正常:
apt-get install nodejs
但我需要这个特定版本,而不是最新版本。我正在为 Docker 映像执行此操作,因此必须在运行时安装它。
解决方案
确保您有以下软件包:-
sudo apt-get install \
apt-transport-https \
curl \
software-properties-common
使用命令启用 NodeSource 存储库:-
sudo curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
启用存储库后,使用以下命令安装 Node.js:-
sudo apt-get install nodejs
推荐阅读
- c - Arch Arm 的交叉编译不会产生功能性可执行文件
- wpf - 使用 mvvm 减少多个窗口
- c++ - 这是当前草案中 [expr.ref]/(4.2) 和 [expr.sub]/1 之间的矛盾吗?
- javascript - 我的按钮中的事件监听器无法正常工作,该函数在单击事件之外正常运行,但是当我单击按钮时它不起作用
- sql - SQL:从 XMLTYPE 中获取值
- python - 在 pandas 中使用 groupby 命令后使用 seaborn 进行绘图
- c# - '没有 'IEnumerable 类型的 ViewData 项
'那有钥匙。 - java - 检测微服务内部进程的完成
- javascript - 用js截屏时出错
- javascript - IE 和 Windows Server 2012 上的 JavaScript 音频元素