NPM常用命令

  1. npm init : 创建一个package.json文件,包括名称、版本、作者等信息;
  2. npm install <name> : 安装nodejs的依赖包;
  3. npm install <name> -g : 将包安装到全局环境中;
  4. npm install <name> –save : 安装的同时,将包的信息写入package.json中;
  5. npm remove <name> : 移除包;
  6. npm update <name> : 更新包;
  7. npm ls : 查看当前安装的所有包;
  8. npm root : 查看当前包的安装路径;
  9. npm root -g : 查看全局安装包的路径;
  10. npm help <topic> : 在默认浏览器中打开指定命令的文档页面,如果topic为空,则列出npm的所有命令;
>npm help
Usage: npm <command>
where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, ddp, dedupe, deprecate, docs, edit,
    explore, faq, find, find-dupes, get, help, help-search,
    home, i, info, init, install, isntall, issues, la, link,
    list, ll, ln, login, ls, outdated, owner, pack, prefix,
    prune, publish, r, rb, rebuild, remove, repo, restart, rm,
    root, run-script, s, se, search, set, show, shrinkwrap,
    star, stars, start, stop, submodule, tag, test, tst, un,
    uninstall, unlink, unpublish, unstar, up, update, version,
    view, whoami
npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

如需转载,烦请注明出处:https://www.qdskill.com/nodejs/4475.html

发表评论

登录后才能评论