npm 與 git 使用技巧

npm

為了讓你更了解 npm,我們要做兩件事(可不做)
運(yùn)行 npm config set loglevel http,讓你知道 npm 發(fā)的每一個請求
運(yùn)行 npm config set progress false,關(guān)閉那個進(jìn)度條
為了讓你的安裝速度變快,運(yùn)行 npm config set registry https://registry.npm.taobao.org/
這會讓你在運(yùn)行 npm adduser 的時候出問題,想要恢復(fù)成原樣,只需要 npm config delete registry 即可

nrm:
$ nrm ls
$ nrm use xxx

npm install -g nrm --registry=https://registry.npm.taobao.org

npm i --verbose

顯示安裝信息

npm run

使用npm run script 提升作用變量
start test可不用run

git

解決沖突:
$ git stash
$ git pull
$ git stash pop

git pull = git fetch + git merge

git fetch origin master
git merge FETCH_HEAD
手動commit提交更改

yarn

yarn config set registry 'https://registry.npm.taobao.org'

yarn與npm對照表

yarn / yarn install -> npm install
yarn add -> npm install --save
yarn remove -> npm uninstall --save
yarn add --dev -> npm install --save-dev
yarn upgrade -> npm update --save
yarn global add -> npm install -g

git submodule 子模塊用法

$ git submodule add git@github.com:slashhuang/pure-node-notebook-fe.git   public
$ git submodule init public
$ git submodule update // 進(jìn)行clone
// 出現(xiàn)問題
$ rm -rf public  ==> 刪除原先的依賴
$ git add . 
$ git commit -am 'remove public'
$ git push 
$ git submodule update public // 然后隨心
如果已經(jīng)有submodule那就調(diào)用
$ git submodule XXX  update
可以直接 git clone xxx public 
cd public
npm i
npm start
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,699評論 19 139
  • npm是什么 NPM的全稱是Node Package Manager,是隨同NodeJS一起安裝的包管理和分發(fā)工具...
    build1024閱讀 8,156評論 0 9
  • 描述 npm從以下來源獲取配置值,按優(yōu)先級排序: 命令行標(biāo)記 在命令行上放置--foo bar設(shè)置foo配置參數(shù)為...
    竹天亮閱讀 44,522評論 0 8
  • Yarn 初始化一個項(xiàng)目 yarn init 相當(dāng) npm init yarn add添加一個包 相當(dāng) ...
    FConfidence閱讀 29,012評論 5 19
  • 廣東的三月,正值回南天。 天氣陰晴不定,風(fēng)雨莫測。時而煙雨蒙蒙,霧海蒼茫;時而陰風(fēng)陣陣,涼氣逼人。一整個月里,很少...
    Hold_Your_Color閱讀 853評論 0 2

友情鏈接更多精彩內(nèi)容