Yarn 包管理工具



已經安裝的

yarn add  vue
vue@2.2.5

yarn add   element-ui   -S 


yarn add bootstrap@4.0.0 -alpha.6  --save
 
yarn add @ng-bootstrap/ng-bootstrap --save
ng-bootstrap 以指令 (directive) 的形式提供組件, 方便在 html 視圖中使用, 選擇器 (selector) 使用同一的前綴 ngb , 類名則統一使用 Ngb 前綴。

更詳細的博客
http://www.open-open.com/lib/view/open1478485680274.html

yarn 原倉庫 包下載不 穩定,需要設置倉庫為 tnpm 或在 cnpm
yarn config set registry “https://registry.npm.taobao.org”

Yarn 包管理工具 介紹:

Facebook出的,因為 node自帶的 npm 包管理工具有缺陷
似乎是它獨有的特性--離線模式: 一次在線聯網安裝包,永久離線使用,無需再聯網重復地下載

直接用 Yarn官網 的描述 : (注:查看官網的文檔和下載安裝包可能需要科學上網)

 

 

 
 
 
下載, 安裝, 配置環境變量
下載
最新穩定版  v0.21.3 (2017.3.18 最新) ,有候選發布版本 v0.22.0 
我把下載鏈接放在CSDN上

5M左右,不大

安裝
一直下一步,我安裝在C盤,因為我的 node 也是安裝在那里。我不清楚安裝在其他盤會不會影響到后面的操作,所以保險起見,安裝在C盤
安裝在  C:\Program Files (x86)\Yarn\bin


配置環境變量
這是為了告訴 cmd命令窗口 去  C:\Program Files (x86)\Yarn\bin 文件夾下執行yarn命令, 具體的操作百度吧
我是用  在PATH里引用環境變量”  這種方式來配置的
 
驗證是否安裝成功:yarn --version
如果出現版本號,說明安裝 成功  且 環境變量配置正確
沒有的話,極有可能是環境變量配置錯誤

使用:

官方文檔截圖

實際操作:
yarn init
先cd到你的項目的文件夾下
如果yarn命令不可用,檢查一下環境變量是否配置正確
安裝過程中,我 什么都不寫一直回車,全部用默認配置:


倒數第二行提示 會在當前文件夾下生成如下 package .json 文件:
(此文件功能:描述項目的基本信息和依賴包的信息

yarn add jq uery
注釋  : "  jq uery  和  " jQuery  " 似乎 是不同的包,也就是說,包名區分大小寫

yarn add jQuery
 
安裝了兩個包后, package .json  文件 會自動變成這樣:
 
看已經安裝了的
yarn list
我標紅色的是重點,不是報錯
效果  3.26. 2017:
yarn list v0.21.3
warning No license field

├─ @ng-bootstrap/ng-bootstrap@1.0.0-alpha.22
├─ ansi-regex@2.1.1
├─ ansi-styles@2.2.1
├─ async-validator@1.6.8
├─ babel-helper-vue-jsx-merge-props@2.0.2
├─ balanced-match@0.4.2
├─ block-stream@0.0.9
│  └─ inherits@~2.0.0
├─ bootstrap@4.0.0-alpha.6
│  ├─ jquery@>=1.9.1
│  └─ tether@^1.4.0
├─ brace-expansion@1.1.6
│  ├─ balanced-match@^0.4.1
│  └─ concat-map@0.0.1
├─ buffer-from@0.1.1
│  └─ is-array-buffer-x@^1.0.13
├─ buffer-shims@1.0.0
├─ builtins@1.0.3
├─ chalk@1.1.3
│  ├─ ansi-styles@^2.2.1
│  ├─ escape-string-regexp@^1.0.2
│  ├─ has-ansi@^2.0.0
│  ├─ strip-ansi@^3.0.0
│  └─ supports-color@^2.0.0
├─ commander@2.9.0
│  └─ graceful-readlink@>= 1.0.0
├─ concat-map@0.0.1
├─ core-util-is@1.0.2
├─ create-react-app@1.3.0
│  ├─ chalk@^1.1.1
│  ├─ commander@^2.9.0
│  ├─ cross-spawn@^4.0.0
│  ├─ fs-extra@^1.0.0
│  ├─ hyperquest@^2.1.2
│  ├─ semver@^5.0.3
│  ├─ tar-pack@^3.4.0
│  ├─ tmp@0.0.31
│  └─ validate-npm-package-name@^3.0.0
├─ cross-spawn@4.0.2
│  ├─ lru-cache@^4.0.1
│  └─ which@^1.2.9
├─ debug@2.6.3
│  └─ ms@0.7.2
├─ deepmerge@1.3.2
├─ duplexer2@0.0.2
│  ├─ readable-stream@~1.1.9
│  └─ readable-stream@1.1.14
│  │  ├─ core-util-is@~1.0.0
│  │  ├─ inherits@~2.0.1
│  │  ├─ isarray@0.0.1
│  │  └─ string_decoder@~0.10.x
├─ element-ui@1.2.5
│  ├─ async-validator@^1.6.6
│  ├─ babel-helper-vue-jsx-merge-props@^2.0.0
│  ├─ deepmerge@^1.2.0
│  └─ throttle-debounce@^1.0.1
├─ escape-string-regexp@1.0.5
├─ fs-extra@1.0.0
│  ├─ graceful-fs@^4.1.2
│  ├─ jsonfile@^2.1.0
│  └─ klaw@^1.0.0
├─ fs.realpath@1.0.0
├─ fstream-ignore@1.0.5
│  ├─ fstream@^1.0.0
│  ├─ inherits@2
│  └─ minimatch@^3.0.0
├─ fstream@1.0.11
│  ├─ graceful-fs@^4.1.2
│  ├─ inherits@~2.0.0
│  ├─ mkdirp@>=0.5 0
│  └─ rimraf@2
├─ glob@7.1.1
│  ├─ fs.realpath@^1.0.0
│  ├─ inflight@^1.0.4
│  ├─ inherits@2
│  ├─ minimatch@^3.0.2
│  ├─ once@^1.3.0
│  └─ path-is-absolute@^1.0.0
├─ graceful-fs@4.1.11
├─ graceful-readlink@1.0.1
├─ has-ansi@2.0.0
│  └─ ansi-regex@^2.0.0
├─ has-symbol-support-x@1.1.0
├─ has-to-string-tag-x@1.1.0
│  └─ has-symbol-support-x@^1.1.0
├─ hyperquest@2.1.2
│  ├─ buffer-from@^0.1.1
│  ├─ duplexer2@~0.0.2
│  └─ through2@~0.6.3
├─ inflight@1.0.6
│  ├─ once@^1.3.0
│  └─ wrappy@1
├─ inherits@2.0.3
├─ is-array-buffer-x@1.1.0
│  ├─ has-to-string-tag-x@^1.1.0
│  ├─ is-object-like-x@^1.1.0
│  └─ to-string-tag-x@^1.1.0
├─ is-function-x@1.1.0
│  ├─ has-to-string-tag-x@^1.1.0
│  ├─ is-primitive@^2.0.0
│  └─ to-string-tag-x@^1.1.0
├─ is-object-like-x@1.1.0
│  ├─ is-function-x@^1.1.0
│  └─ is-primitive@^2.0.0
├─ is-primitive@2.0.0
├─ isarray@0.0.1
├─ isexe@2.0.0
├─ jquery@3.2.1
├─ jsonfile@2.4.0
│  └─ graceful-fs@^4.1.6
├─ klaw@1.3.1
│  └─ graceful-fs@^4.1.9
├─ lodash.isnull@3.0.0
├─ lru-cache@4.0.2
│  ├─ pseudomap@^1.0.1
│  └─ yallist@^2.0.0
├─ minimatch@3.0.3
│  └─ brace-expansion@^1.0.0
├─ minimist@0.0.8
├─ mkdirp@0.5.1
│  └─ minimist@0.0.8
├─ ms@0.7.2
├─ once@1.4.0
│  └─ wrappy@1
├─ os-tmpdir@1.0.2
├─ path-is-absolute@1.0.1
├─ process-nextick-args@1.0.7
├─ pseudomap@1.0.2
├─ readable-stream@2.2.6
│  ├─ buffer-shims@^1.0.0
│  ├─ core-util-is@~1.0.0
│  ├─ inherits@~2.0.1
│  ├─ isarray@~1.0.0
│  ├─ isarray@1.0.0
│  ├─ process-nextick-args@~1.0.6
│  ├─ string_decoder@~0.10.x
│  └─ util-deprecate@~1.0.1
├─ rimraf@2.6.1
│  └─ glob@^7.0.5
├─ semver@5.3.0
├─ string_decoder@0.10.31
├─ strip-ansi@3.0.1
│  └─ ansi-regex@^2.0.0
├─ supports-color@2.0.0
├─ tar-pack@3.4.0
│  ├─ debug@^2.2.0
│  ├─ fstream-ignore@^1.0.5
│  ├─ fstream@^1.0.10
│  ├─ once@^1.3.3
│  ├─ readable-stream@^2.1.4
│  ├─ rimraf@^2.5.1
│  ├─ tar@^2.2.1
│  └─ uid-number@^0.0.6
├─ tar@2.2.1
│  ├─ block-stream@*
│  ├─ fstream@^1.0.2
│  └─ inherits@2
├─ tether@1.4.0
├─ throttle-debounce@1.0.1
├─ through2@0.6.5
│  ├─ readable-stream@>=1.0.33-1 <1.1.0-0
│  ├─ readable-stream@1.0.34
│  │  ├─ core-util-is@~1.0.0
│  │  ├─ inherits@~2.0.1
│  │  ├─ isarray@0.0.1
│  │  └─ string_decoder@~0.10.x
│  └─ xtend@>=4.0.0 <4.1.0-0
├─ tmp@0.0.31
│  └─ os-tmpdir@~1.0.1
├─ to-string-tag-x@1.1.0
│  ├─ lodash.isnull@^3.0.0
│  └─ validate.io-undefined@^1.0.3
├─ uid-number@0.0.6
├─ util-deprecate@1.0.2
├─ validate-npm-package-name@3.0.0
│  └─ builtins@^1.0.3
├─ validate.io-undefined@1.0.3
├─ vue@2.2.5
├─ which@1.2.14
│  └─ isexe@^2.0.0
├─ wrappy@1.0.2
├─ xtend@4.0.1
└─ yallist@2.1.2








免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM