npm package from private github repo, install vs u

2019-08-07 13:31发布

问题:

I have already seen this question npm-install-vs-update-whats-the-difference

My question is around using install vs update for private github repo using git+ urls.

I have a private github repo which is used in the grunt. This repo receives frequent updates. I installed this repo using git+ssh url as mentioned here npm install git remote url

Everything works fine when installing. Problem comes when updating the package. As per my understanding and question mentioned above, npm updates the package to latest version when doing npm install but this doesnt seem to be case with package installed from github. I had to use npm update to get the latest version. I dont mind using npm update but I have observed that its slow compared to npm install. Can anyone put their thoughts why this might be happening.

My package.json looks like following

{
  "name": "My Project",
  "version": "1.0.0",
  "dependencies": {
    "grunt": "^0.4.5",
    //Relevent package
    "my-tasks": "git+ssh://git@github.com:Flutterbee/my-tasks.git" 
  }
}

PS : Using npm 3.3.3 (if that makes difference)

回答1:

can you try with specifying the branch name with in your package.json like this "my-tasks": "git+ssh://git@github.com:Flutterbee/my-tasks.git#master"