Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

115
Views
NPM install from github using a tag

I need to do a npm install into my angular2 project from git but using a tag which is tag = 6.0.0.

e.g.

git git@github.com:akveo/ng2-smart-table.git
cd ng2-smart-table
git checkout tags/v0.6.0-0

How would I do the equivalent of :

  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:
8 months ago · Santiago Trujillo
3 answers
Answer question

0

NPM allows installation using commit-ish tags on GitHub:

npm install <git remote url>

for example:

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

Note that you need to specify the protocol in the url, e.g. git+https://.

Documentation: https://docs.npmjs.com/cli/install

8 months ago · Santiago Trujillo Report

0

Another option from the npm docs:

As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project". Just as with git URLs, a commit-ish suffix can be included.

These 2 commands install the same tag v0.6.0-0 of the akveo/ng2-smart-table github repo (tested npm version 5.4.2)

npm install akveo/ng2-smart-table#v0.6.0-0

npm install github:akveo/ng2-smart-table#v0.6.0-0

8 months ago · Santiago Trujillo Report

0

As explained above how to install the repository via NPM here is some extra info to complete the above answer.

If you don't want to worry about the protocol meaning that you don't want to change the URL from the original URL you can set the URL re-writing in the following format:

git config --global url."https://".insteadOf git://
8 months ago · Santiago Trujillo Report
Answer question
Find remote jobs