npm git repository not updating versions

前端 未结 2 497
迷失自我
迷失自我 2021-02-13 04:32

I have an git repo and I\'m trying to set it as a dependency in my project. Using NPM, my package.json looks like this:

\"devDependencies\": {
  \"g         


        
相关标签:
2条回答
  • 2021-02-13 04:54

    This have been fixed in npm, please upgrade to npm >= 1.3.10

    Sample usage

    "dependencies": { "thing": "git://github.com/myGitHubRepo/repo.js.git#56477cb", }

    Some day later

    "dependencies": { "thing": "git://github.com/myGitHubRepo/repo.js.git#67f90b5", }

    Then npm install again and you will get new ref!

    If your "myGitHubRepo/repo.js" is a private package you should set "private": true there to ensure it doesn't get accidentally published to npm registry

    0 讨论(0)
  • 2021-02-13 04:56

    Ok this is how it is done.

    I was also confused.

    So i have a private npm module at git@github.com:myModule/MySweetModule.git I have just published the latest tagged version. Unfortunately i cannot figure out how that works, BUT it works off your master. SOOO your master branch can be your integration branch and you have stage branch for building up the next version. Upon version completion, just merge it into master and increment your private repo's version (so your private repo now went from 1.0.0 to 1.0.1). If you call npm install it will update your repo if the master's package.json version is greater than current working repo. It will always take the latest repo.

    That seems like it sucks

    I agree. So lets do it a better way! If you tags for your private repo releases you can reference them by "custom": "git+ssh://git@github.com:usr/proj.git#TAG_NAME"

    So it i have a tag called 0.1.0, then i would have the url in package.json versioned like so. "custom": "git+ssh://git@github.com:usr/proj.git#0.1.0"

    I believe that this is the best approach to your answer. But i am not a gitanista

    WARNING

    If you try to go back a version, it appears it does not work. so from version 0.2.2 to 0.2.1 it will not update your project. Make sure you do npm remove myProj then npm install if you roll back a version.

    0 讨论(0)
提交回复
热议问题