专业的编程技术博客社区

网站首页 > 博客文章 正文

帮你精通JS:NPM 包管理极速入门(npm package)

baijin 2024-08-21 11:17:15 博客文章 5 ℃ 0 评论

闲话少叙,最快捷的上手NPM命令行操作的途径,就是求问tldr:

 - Interactively create a package.json file:
   npm init

 - Download all the packages listed as dependencies in package.json:
   npm install

 - Download a specific version of a package and add it to the list of dependencies in package.json:
   npm install {{module_name}}@{{version}}

 - Download a package and add it to the list of dev dependencies in package.json:
   npm install {{module_name}} --save-dev

 - Download a package and install it globally:
   npm install -g {{module_name}}

 - Uninstall a package and remove it from the list of dependencies in package.json:
   npm uninstall {{module_name}}

 - Print a tree of locally-installed dependencies:
   npm list

 - List top-level globally installed modules:
   npm list -g --depth={{0}}

首先对package初始化

npm init
npm init -y

全局安装与局域安装:

npm install -g <package>
npm install <package>

或者安装只作开发阶段使用:

npm install --save-dev <package>

最后是安装包的卸载:

npm uninstall <package>

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表