[英]NPM install from github using a tag
我需要從git到我的angular2項目中進行npm安裝,但使用的標簽是tag = 6.0.0。
例如
git git@github.com:akveo/ng2-smart-table.git
cd ng2-smart-table
git checkout tags/v0.6.0-0
我將如何做:
npm install --save PACKAGE_NAME
npm install git@github.com:akveo/ng2-smart-table.git#v0.6.0-0
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/Cellar/node/6.5.0/bin/node" "/usr/local/bin/npm" "install" "git@github.com:akveo/ng2-smart-table.git#v0.6.0-0"
npm ERR! node v7.0.0
npm ERR! npm v3.10.8
npm ERR! Unsupported URL Type: github.com:akveo/ng2-smart-table.git#v0.6.0-0
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
NPM允許使用GitHub上的commit-ish
標簽進行安裝:
npm install <git remote url>
例如:
npm install git+ssh://git@github.com:npm/npm.git#v1.0.27
npm install git+https://isaacs@github.com/npm/npm.git
npm install git://github.com/npm/npm.git#v1.0.27
請注意,您需要在url中指定協議,例如git+https://
。
來自npm docs的另一種選擇:
從1.1.65版本開始,您可以將GitHub URL簡稱為“ foo”:“ user / foo-project”。 與git URL一樣,可以包含提交后綴。
這2條命令將安裝akveo / ng2-smart-table github存儲庫的相同標簽v0.6.0-0
(已測試npm版本5.4.2
)
npm install akveo/ng2-smart-table#v0.6.0-0
npm install github:akveo/ng2-smart-table#v0.6.0-0
如上所述,如何通過NPM安裝存儲庫,這里是一些額外的信息來完成上述答案。
如果您不想擔心協議的含義,即不想從原始URL更改URL,則可以使用以下格式設置URL重寫:
git config --global url."https://".insteadOf git://
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.