美文网首页
npm常用命令

npm常用命令

作者: 滚石_c2a6 | 来源:发表于2018-04-03 16:31 被阅读8次
  1. npm init [-f|--force|-y|--yes]
    This will ask you a bunch of questions, and then write a package.json for you.
    If you invoke it with -f, --force, -y, or --yes, it will use only defaults and not prompt you for any options.

2.npm install
Install the dependencies in the local node_modules folder.
By default, npm install will install all modules listed as dependencies in package.json

-P, --save-prod: Package will appear in your dependencies. This is the default unless -D or -O are present.
-D, --save-dev: Package will appear in your devDependencies.
-E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm's default semver range operator.

3.npm ls
参数:
global
List packages in the global install prefix instead of in the current project.
depth
Max display depth of the dependency tree.
prod
Display only the dependency tree for packages in dependencies.
dev
Display only the dependency tree for packages in devDependencies.
示例;npm ls --depth=0 -g

4.npm uninstall
npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save]
aliases: remove, rm, r, un, unlink

--no-save: Package will not be removed from your package.json file.

5.npm update [-g] [<pkg>...]
aliases: up, upgrade

6.npm cache clean [<path>]
aliases: npm cache clear, npm cache rm
7.npm config
npm config list
npm config set <key> <value> [-g|--global]
npm config get <key>

修改源地址为淘宝 NPM 镜像:
npm config set registry http://registry.npm.taobao.org/
修改源地址为官方源:
npm config set registry https://registry.npmjs.org/

相关文章

  • npm 常用命令缩写

    npm 常用命令缩写,不断更新 npm i === npm install npm i webpack -D ==...

  • ionic常用命令

    常用命令: npm install -g cnpm --registry=https://registry.npm...

  • [mark] npm 了解一下~

    npm 常用命令及解析

  • npm常用命令

    npm常用命令 npm init 生成package.json文件 npm install 安装package.j...

  • Yarn 常用命令

    Yarn 常用命令 ``` npm install === yarn —— install安装是默认行为 npm ...

  • nodejs npm 常用命令

    国内镜像 设置代理 npm设置列表 npm config 所有的api npm 常用命令npm查看全局安装过的包 ...

  • Angular 学习笔记

    几个常用命令 npm + ng npm i --save 包名:软件依赖 npm i --save-dev 包名...

  • NPM

    npm 常用命令 1.react-native --version ...

  • npm命令

    1.查看npm 版本 2.npm淘宝镜像 3.npm常用命令说明 4.npm卸载 5.npm更新 6.npm清除缓...

  • NPM一些常用命令

    欢迎移步我的博客阅读:《NPM一些常用命令》 关于NPM NPM的全称是Node Package Manager,...

网友评论

      本文标题:npm常用命令

      本文链接:https://www.haomeiwen.com/subject/nexchftx.html