npm git仓库不更新版本 [英] npm git repository not updating versions

查看:320
本文介绍了npm git仓库不更新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个git repo,我正在尝试将其设置为我项目中的依赖项。
使用NPM,我的 package.json 看起来像这样:

  devDependencies:{
grunt:〜0.4.0,
grunt-contrib-connect:〜0.2.0,
grunt-contrib- watch:〜0.3.1,
custom: git://github.com/myGitHubRepo/repo.js.git#b7d53a0cfbe496ad89bde6f22324219d098dedb3,
grunt-contrib-copy: 〜0.4.0
}

在第一个

  npm install 

安装一切,并毫无问题地获取存储库。但是,如果我将提交哈希值更改为

  custom: git://github.com/myGitHubRepo/repo .js.git#d6da3a0 ...,//另一个

它不会更新!有人可以指出我该怎么做吗?



我只想共享此代码,并能够在某个时候更改此版本和 npm 会自动更新它。

解决方案

好的,这是这样做的。



我也感到困惑。



所以我在git@github.com:myModule上有一个私有npm模块/MySweetModule.git
我刚刚发布了最新的标记版本。不幸的是,我无法弄清楚它是如何工作的,但是它对您的主人有效。 SOOO您的主分支可以是您的集成分支,并且您还有用于构建下一个版本的舞台分支。版本完成后,只需将其合并到主版本中,然后增加您的私人存储库的版本(因此您的私人存储库现在从1.0.0升级到1.0.1)。如果您调用 npm install ,则如果主服务器的package.json版本大于当前的工作仓库,它将更新您的仓库。

好像很烂



我同意。因此,让我们做一个更好的方法吧!如果您为私有存储库版本发布 tags ,则可以通过 custom引用它们: git + ssh://git@github.com:usr /proj.git#TAG_NAME



所以我有一个名为 0.1.0 ,那么我将在package.json中将URL版本化为这样。 自定义: git + ssh://git@github.com:usr / proj.git#0.1.0



我相信这是回答问题的最佳方法。但是我不是gitanista



警告



如果您尝试返回一个版本,它似乎不起作用。因此,从版本 0.2.2 0.2.1 ,它不会更新您的项目。如果回滚版本,请确保先执行 npm删除myProj ,然后执行 npm install


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": {
  "grunt": "~0.4.0",
  "grunt-contrib-connect": "~0.2.0",
  "grunt-contrib-watch": "~0.3.1",
  "custom":     "git://github.com/myGitHubRepo/repo.js.git#b7d53a0cfbe496ad89bde6f22324219d098dedb3",
  "grunt-contrib-copy": "~0.4.0"
}

On the first

npm install

It install everything and fetches the repository with no problem. But if I change this commit hash to let's say

"custom":     "git://github.com/myGitHubRepo/repo.js.git#d6da3a0...", // a different one

It doesn't update! Can anyone point me out how could I get this behavior?

I would simply like to share this code and be able to at some point change this version and the npm would automatically update this.

解决方案

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.

这篇关于npm git仓库不更新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆