簡體   English   中英

為什么我在使用 apt-get 安裝時會得到舊版本的 nodejs 和 npm?

[英]Why do I get old versions of nodejs and npm when installing with apt-get?

我在 Ubuntu 14.04 64 位中執行了以下命令。

sudo apt-get update
sudo apt-get install nodejs modejs-legacy npm

我有版本

npm -v
1.3.10

nodejs -v
v0.10.25

這些比 AngularJS 2 的推薦版本舊。

為什么apt-get下載舊版本? 如何更新到較新的版本?

Debian/Ubuntu 在他們的包管理器中有舊版本,你必須使用自定義 PPA 存儲庫,如下所述:

https://github.com/nodesource/distributions/blob/master/README.md#debinstall

設置它:

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -

然后用 Ubuntu 安裝:

sudo apt-get install --yes nodejs

要獲得最新版本,最簡單的方法是安裝 nvm。 nvm 安裝說明

  1. 安裝 nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
  2. nvm install v10.15.3
  3. (可選)設置默認nvm alias default v10.15.3

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM