查看npm版本
npm -v
npm初始化项目
npm init
npm安装模块
npm install jquery
npm install jquery@1.9.1 --save-dev
npm卸载模块
npm uninstall jquery 卸载模块,但不卸载模块留在package.json中的对应信息
npm uninstall jquery -g 卸载全局模块
npm uninstall jquery --save 卸载模块,同时卸载留在package.json中dependencies下的信息
npm uninstall jquery --save-dev 卸载模块,同时卸载留在package.json中devDependencies下的信息
npm更新模块
npm update jquery 更新最新版本的jquery
npm update jquery@2.1.0 更新到指定版本号的jquery
npm install jquery@latest 可以直接更新到最新的版本
npm查看命令
npm root 查看项目中模块所在的目录
npm root -g 查看全局安装的模块所在目录
npm list 或者 npm ls 查看本地已安装模块的清单列表
npm view jquery dependencies 查看某个包对于各种包的依赖关系
npm view jquery version 查看jquery最新的版本号
npm view jquery versions 查看所有jquery的版本号
npm view jquery 查看最新的jquery版本的信息
npm info jquery 查看jquery的详细信息,等同于上面的npm view jquery
npm list jquery 或者 npm ls jquery 查看本地已安装的jquery的详细信息
npm view jquery repository.url 查看jquery包的来源地址
npm其他命令
npm cache clean 清除npm的缓存
npm prune 清除项目中没有被使用的包
npm outdated 检查模块是否已经过时
npm repo jquery 会打开默认浏览器跳转到github中jquery的页面
npm docs jquery 会打开默认浏览器跳转到github中jquery的README.MD文件信息
npm home jquery 会打开默认浏览器跳转到github中jquery的主页
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。