node中npm的常用命令

node中npm的常用命令


关于版本

//node 版本
node -v
//npm 版本
npm -v
或
npm -version
//node中本机相关版本
npm -versions
{
  npm: '6.14.17',
  ares: '1.18.1',
  brotli: '1.0.9',
  cldr: '40.0',
  icu: '70.1',
  llhttp: '2.1.6',
  modules: '83',
  napi: '8',
  nghttp2: '1.42.0',
  node: '14.21.1',
  openssl: '1.1.1q',
  tz: '2022e',
  unicode: '14.0',
  uv: '1.42.0',
  v8: '8.4.371.23-node.87',
  zlib: '1.2.11'
}
//查看当前node环境配置
npm config ls -l
//查看本项目中已安装依赖包
npm list
//查看本机已安装依赖包
npm list -g
//查看VUE最新
npm view vue
//查看本机VUE版本
npm view vue version
//查看VUE有哪些版本
npm view vue versions
// 安装包
npm install xxx
// 全局安装包
npm install -g xxx 
// 安装包并记录在package.json文件中
npm install xxx --save
// 安装指定版本(安装3.0.0版本包)
npm install xxx@3.0.0
// package.json文件说明
~会匹配最近的小版本依赖包,比如~1.2.3会匹配所有1.2.x版本,但是不包括1.3.0
^会匹配最新的大版本依赖包,比如^1.2.3会匹配所有1.x.x的包,包括1.3.0,但是不包括2.0.0
*会安装最新版本的依赖包

//更新
npm update xxx 
npm update xxx@1.0.0
//全局更新
npm update -g xxx 
npm update -g xxx@1.0.0 

//删除 node_modules 目录下面的包(package)
npm unistall xxx
//如需从 package.json 文件中删除依赖,需要在命令后添加参数 --save
npm uninstall --save xxx
//全局删除 node_modules 目录下面的包(package)
npm uninstall -g xxx

npm run dev

npm run build

npm cache clean --force

npm install -g rimraf 

rimraf node_modules

npm -h

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, fund, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, 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 <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值