yarn 的使用 及 npm 命令對比

 

1、初始化一個新的項目

yarn init

2、添加一個依賴包

yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]

3、安裝所有的依賴包

yarn 或者 yarn install

4、npm 與 yarn命令比較

NPMYARN說明
npm init yarn init 初始化某個項目
npm install/link yarn install/link 默認的安裝依賴操作
npm install taco —save yarn add taco 安裝某個依賴,並且默認保存到package.
npm uninstall taco —save yarn remove taco 移除某個依賴項目
npm install taco —save-dev yarn add taco —dev 安裝某個開發時依賴項目
npm update taco —save yarn upgrade taco 更新某個依賴項目
npm install taco --global yarn global add taco 安裝某個全局依賴項目
npm publish/login/logout yarn publish/login/logout 發佈/登錄/登出,一系列NPM Registry操作
npm run/test yarn run/test 運行某個命令

 

 

 

 

.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章