NPM常用命令

NPM常用命令整理

操作环境

操作环境:Windows系统(Win7、Win10)
所有的命令都再 CMD 或者 PowerShell 下面操作

NPM设置相关操作

设置全局安装环境

/* 设置 */
npm config set prefix "D:\Program Files\nodejs\node_modules\node_global"
/* 查看 */
npm root -g

设置npm 的镜像

/* 设置 */
npm config set registry https://registry.npm.taobao.org
/* 查看 */
npm config get registry

设置安装的缓存路径

/* 设置 */
npm config set cache "D:\Program Files\nodejs\node_modules\node_cache"
/* 查看 */
npm config get cache

清理缓存

npm cache clean

NPM安装第三方包

/* 全局安装 */
npm install -g typescript 
/* 普通安装 */
npm install typescript

/* 查看已安装的模块 */
npm list -g --depth 0

/* 查找指定的模块 */
npm ls -graceful-fs
npm ls minimatch

/* 全局查找指定的模块 */
npm ls -g node-gyp

NPM 管理插件

NPM的管理工具

/* NPM registry 管理工具 */
npm install -g nrm

nrm help
nrm ls

/* 切换到 cnpm */
nrm use cnpm
/* 浏览器打开首页 */
nrm home    

清理 node_modules

window 删除顽固 node_modules
/* 安装 */
npm install -g rimraf

/* 跳转到指定的目录下 */
rimraf node_modules/

所安装的包的版本

/* 安装 */
npm i -g npm-check
/* 查看 */
npm-check -g

安装开发插件

typescrip 编译环境

/* 下载安装 */
npm i -g typescrip 
/* 查看版本 */
tsc -v
/* 编译 ts 文件 */
tsc hello.ts

Angular 相关

-- 新建只有空文件工程 没有 node_modules
ng new auction --dir=.

-- 带有 路由的工程
ng new router --routing 

-- 新建一个工程,但是跳过安装 node_modules 的依赖
ng  new my-app --skip-install

ng set --global warnings.versionMismatch=false

备注
1.NPM官网
2.NPM官方文档
3.npm-check说明文档
4.nrm说明文档
5.Angular环境安装说明

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值