npm命令對應的yarn命令:
npm init ------ yarn init
npm run ------ yarn run**
npm install ** ------ yarn instal**
npm install ** —save ----- yarn add**
npm uninstall ** —save ------- yarn remove**
npm install ** —save-dev ------ yarn add ** —dev
npm update ** —save ------- yarn upgrade**
npm install ** --global -------- yarn global add**
–save 和 -dev 的區別
npm i **
: 安裝模塊到項目目錄下
npm i -g **
:將模塊安裝到全局,具體安裝到磁盤那個位置,要看npm config prefix的位置
npm i -save **
:將模塊安裝到項目目錄下,並寫入packjson的dependencies
npm i -save-dev **
:將模塊安裝到項目目錄下,並寫入package的devDependencies下
(其實就是隻在開發環境下就用-save-dev **
, 在生產環境下還要繼續使用的就用 -save
)