学堂 学堂 学堂公众号手机端

Ubuntu中如何安装nodejs和npm,操作是什么

lewis 1年前 (2024-04-25) 阅读数 20 #技术
在实际应用中,我们有时候会遇到“Ubuntu中如何安装nodejs和npm,操作是什么”这样的问题,我们该怎样来处理呢?下文给大家介绍了解决方法,希望这篇“Ubuntu中如何安装nodejs和npm,操作是什么”文章能帮助大家解决问题。



1.安装python-software-properties

sudo apt-get install python-software-properties

2.添加ppa

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

3.安装nodejs和npm

sudo apt-get install nodejs

4.查看版本

$ node -v
v8.11.1
$ npm -v
5.6.0

5.配置npm仓库

sudo npm install -g nrm
$ nrm ls

* npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
  taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/

$ nrm use taobao
Registry has been set to: https://registry.npm.taobao.org/

到此这篇关于“Ubuntu中如何安装nodejs和npm,操作是什么”的文章就介绍到这了,更多相关Ubuntu中如何安装nodejs和npm,操作是什么内容,欢迎关注博信技术资讯频道,小编将为大家输出更多高质量的实用文章!
版权声明

本文仅代表作者观点,不代表博信信息网立场。

热门