-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
25 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,8 +76,20 @@ pnpm config set cache-dir "D:\pnpm\cache" # pnpm全局缓存路径 | |
|
||
# 7. 包管理器辨别 | ||
|
||
- `npm`是一个包管理器,方便开发者分享和下载开源包。经历了许多重大版本的更新,各方面已经和`yar`n在同一水平。 | ||
- `npm`是一个包管理器,方便开发者分享和下载开源包。经历了许多重大版本的更新,各方面已经和`yarn`在同一水平。 | ||
- `npx`是`[email protected]`的产物,`npx`会把下载的文件放在临时文件中,过一段时间会自动清除,但不会**立即**清除。 | ||
- `cnpm`是方便中国开发者下载依赖包而诞生的下载器。 | ||
- `yarn`解决了`npm@5`之前的一些让人诟病的问题,同时拥有一些其它的优点。例如离线安装、失败自动重试安装和并行下载等。 | ||
- `pnpm`通过连接的方式,让多个项目的依赖公用同一个包,大大节省了磁盘空间,比`yarn`和`npm`下载速度快得多,但是也有连接带来的各种兼容问题。 | ||
- `pnpm`通过连接的方式,让多个项目的依赖公用同一个包,大大节省了磁盘空间,比`yarn`和`npm`下载速度快得多,但是也有连接带来的各种兼容问题。 | ||
|
||
# 8. npm 使用 | ||
|
||
**npm安装依赖** | ||
npm install xxx 利用 npm 安装xxx依赖到当前命令行所在目录 | ||
npm install xxx -g 利用npm安装全局依赖xxx | ||
npm install xxx –save 安装并写入package.json的”dependencies”中 | ||
npm install xxx –save-dev 安装并写入package.json的”devDependencies”中 | ||
|
||
**npm删除依赖** | ||
npm uninstall xxx 删除xxx依赖 | ||
npm uninstall xxx -g 删除全局依赖xxx |