常用命令
查看node版本
node -v
查看npm版本
npm -v
安装cnpm ,-g表示全局安装
npm install cnpm -g
安装npm
cnpm install npm -g
查看npm配置信息
npm config list
查看npm镜像
npm config get registry
设置npm淘宝镜像(官方镜像:https://registry.npmjs.org/)
npm config set registry https://registry.npmmirror.com
使用npm安装依赖,安装特定版本用@进行指定
npm install 依赖@版本
安装最新版vue
npm install vue
vue项目安装依赖
npm install
启动vue项目,需要看package.json->scripts
npm run dev 或 npm run server
清空缓存
npm cache clean --forced
nvm管理node版本
查看可用的版本列表
nvm list available
安装node
nvm install 18.20.0
查看安装的版本
nvm ls
使用那个版本的node
nvm use 18.20.0
卸载某个版本node
nvm uninstall 10.0.0