• 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
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
  • 相关阅读:
    face_recognition结合opencv进行多人脸识别
    JVM学习(四)--内存问题分析思路
    架构真题2017(五十三)
    【第三篇】商城系统-基础业务-实现类别管理
    Power BI - 在列表中点击详情按钮跳转到详情页面并传递参数
    scrapy爬虫之网站图片爬取
    开利网络到访东家集团,沟通招商加盟数字化机制落地事项
    倍福Ethercat模块网络诊断和硬件排查的基本方法
    open ai chartgpt 安装插件 txyz.ai
    redis缓存问题
  • 原文地址:https://blog.csdn.net/qq443068902/article/details/128066241