//仓库地址
https://www.npmjs.com/

 

# 调整目录??
npm config set prefix "D:\nodejs\node_global"
npm config set cache "D:\nodejs\node_cache"

 

//查看当前镜像
npm get registry

 

//切换镜像
npm config set registry http://registry.npm.taobao.org
//原地址
npm config set registry http://registry.npmjs.org

 这种方法不建议使用,因为使用这种方式会造成之后都要通过淘宝镜像来获取依赖包,如果是公司内部发布到npm的依赖包,会出现下载失败的情况

 

//初始化一个项目
npm init
npm init -y //不需确认

 

//查看已安装模块
npm list

 

//安装包
npm install vue
npm i vue@3.0.6
//全局安装
npm install -g 模块名

 

//查看全局包路径
npm root -g

 

版本号

js npm_初始化

 

//执行json里的脚本
npm run test

js npm_初始化_02

 

使用cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org