NPM常用命令install 淘宝镜像 update等

  NPM是随同NodeJS一起安装的包管理工具,允许用户从NPM服务器上传下载安装第三方包或命令行程序,能解决NodeJS代码部署上的很多问题,非常方便。下面我们一起来看看常用的npm命令有哪些

使用方法:npm <command命令>,比如 npm -v表示查看版本号,以下是常用的命令
access, adduser, bin, bugs, c, cache, completion, config,
    ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
    explore, get, help, help-search, i, init, install,
    install-test, it, link, list, ln, login, logout, ls,
    outdated, owner, pack, ping, prefix, profile, prune,
    publish, rb, rebuild, repo, restart, root, run, run-script,
    s, se, search, set, shrinkwrap, star, stars, start, stop, t,
    team, test, token, tst, un, uninstall, unpublish, unstar,
    up, update, v, version, view, whoami

   npm install :表示用npm 安装 Node.js 模块,比如用 npm 命令安装常用的 Node.js web框架模块 express:

npm install express

  npm update:升级更新模块

npm update express

  npm uninstall:卸载模块

npm uninstall express

  npm search:搜索模块

npm search express

  npm 淘宝镜像:大家都知道国内直接使用 npm 的官方镜像是非常慢的,这里推荐使用淘宝 NPM 镜像。淘宝 NPM 镜像是一个完整 npmjs.org 镜像,你可以用此代替官方版本(只读),同步频率目前为 10分钟 一次以保证尽量与官方服务同步。你可以使用淘宝定制的 cnpm (gzip 压缩支持) 命令行工具代替默认的 npm:

npm install -g cnpm --registry=https://registry.npm.taobao.org

  这样设置以后就可以使用 cnpm 命令来安装模块了:

cnpm install express

  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值