NPM基本使用
- 查看版本号
npm -v
- 更新npm
npm install npm@5.4.0 // 更新到具体版本
npm install npm@latest -g // 更新到最新版(安装到全局环境下,在每一个目录下命令都会识别)
使用npm
打开Terminal,进入项目的目录cd ~
- 初始化(此时会在项目文件夹生成一个
package.json,项目所需依赖全都记录在此)
npm init -y // (--yes)
- 安装依赖:
jquery(在node_modules文件夹下)
npm install jquery
简写
npm i jquery
- 安装指定版本
npm i jquery@3.0.0
- 恢复
node_modules文件夹下的所有依赖
npm i
- 删除依赖
npm unstall jquery
- 更新依赖
npm update jquery
最后
以上就是悦耳棉花糖最近收集整理的关于NPM基本使用NPM基本使用的全部内容,更多相关NPM基本使用NPM基本使用内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复