private-bower icon indicating copy to clipboard operation
private-bower copied to clipboard

Question around the use of private-bower with git

Open adelinor opened this issue 10 years ago • 19 comments

private-bower is very easy to install and does the job. I could in minutes do a bower install using "my" private bower:

bower install --config.registry=http://localhost:5678

After that I modified the configuration to set a git cache for the repository:

"repositoryCache": {
        "cachePrivate": false,
        "git": {
            "enabled": true,
            "cacheDirectory": "./gitRepoCache",
            "host": "localhost",
            "port": 6789,
            "protocol": "git",
            "publicAccessURL" : null,
            "refreshTimeout": 10
        }
}

After starting the private-bower, I can see that the folder gitRepoCache gets created. After the bower install, I was expecting the retrieved dependencies to be added under gitRepoCache. But that's not the case. The folder gitRepoCache remains empty.

Is the git configuration correct? Did I misunderstood what the git repository cache is about?

adelinor avatar Sep 11 '15 14:09 adelinor

Hey,

This config should work, is there any error on the private-bower console?

Barna

Hacklone avatar Oct 10 '15 08:10 Hacklone

Hi,

From what I remember there was no error in the console.

Wanting to try again the same command as one month ago, I reset the configuration to disable the git cache and I am consistently getting a ENOTFOUND error. This error was not coming up before so I do not know what changed:

bower angular#1.4.5          ENOTFOUND Package angular not found

Stack trace:
Error: Package angular not found
    at createError (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/util/createError.js:4:15)
    at /u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/core/resolverFactory.js:187:23
From previous event:
    at PackageRepository.fetch (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/core/PackageRepository.js:44:6)
    at Manager._fetch (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/core/Manager.js:310:51)
    at Array.forEach (native)
    at Manager.resolve (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/core/Manager.js:113:23)
    at Project._bootstrap (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/core/Project.js:547:6)
    at /u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/core/Project.js:80:21

Console trace:
Error
    at StandardRenderer.error (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/renderers/StandardRenderer.js:82:37)
    at Logger.<anonymous> (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/bin/bower:110:22)
    at Logger.emit (events.js:107:17)
    at Logger.emit (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)
    at /u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/lib/commands/index.js:45:20
    at _rejected (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/node_modules/q/q.js:844:24)
    at /u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/node_modules/q/q.js:870:30
    at Promise.when (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/node_modules/q/q.js:1122:31)
    at Promise.promise.promiseDispatch (/u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/node_modules/q/q.js:788:41)
    at /u01/app/node-v0.12.2-linux-x64/lib/node_modules/bower/node_modules/q/q.js:604:44
System info:
Bower version: 1.5.2
Node version: 0.12.2
OS: Linux 2.6.32-504.1.3.el6.x86_64 x64

adelinor avatar Oct 16 '15 08:10 adelinor

Hey,

I got exactly the same issue as adelinor. No error messages in the console log, but when I try to install bower packages (with bowerrc pointing to my local repository), bower still tries to go to github. The cache directory remains empty.

paszczi avatar Oct 22 '15 14:10 paszczi

If there is anything I can provide to help you, just let me know.

paszczi avatar Oct 28 '15 08:10 paszczi

Seeing this same behavior - no packages are being mirrored.

jalons avatar Oct 28 '15 15:10 jalons

OK I think the issue is quite trivial - try to clear your bower cache.

paszczi avatar Nov 05 '15 10:11 paszczi

I'm getting the same issue.

Installed, registered some packages to private-bower, installed some packages from private-bower. Then for some reason, private-bower stopped falling through to public packages. Cleaning bower cache doesn't help:

sp$ bower cache list
sp$ bower search jquery
No results

I also tried removing bowerRepositoryPublic.json and bowerRepository.json, but this didn't help either.

spodatelev avatar Nov 26 '15 20:11 spodatelev

It appears the problem is in the trailing slash in pbower-confg.json as mentioned in readme:

...
"public": {
    "disabled": false,
    "registry": "http://bower.herokuapp.com/packages/", // wrong, look it up
...

image

...should be

...
"public": {
    "disabled": false,
    "registry": "http://bower.herokuapp.com/packages", // returns JSON list of packages
...

spodatelev avatar Nov 30 '15 16:11 spodatelev

Thanks @spodatelev . The error stack trace reported on October 16 is indeed because of the extra slash the public.registry URL.

adelinor avatar Nov 30 '15 20:11 adelinor

Now back to the original question... I have set the configuration to:

    "repositoryCache": {
        "cachePrivate": true,
        "git": {
            "enabled": true,
            "cacheDirectory": "./gitRepoCache",
            "host": "localhost",
            "port": 6789,
            "protocol": "git",
            "publicAccessURL" : null,
            "refreshTimeout": 10
        }
    }

After running a bower install command on a sample project, dependencies were retrieved successfully by private-bower. A gitRepoCache folder was created but this folder does not contain anything. What is therefore the meaning of this git cache configuration?

adelinor avatar Nov 30 '15 20:11 adelinor

@adelinor Did you ever find a way to resolve this? I'm seeing the same thing.

joshstrange avatar Jan 26 '16 14:01 joshstrange

The error from the comment on Oct 16, 2015 was resolved thanks to the tip of @spodatelev .

My original question about the meaning of the git repository cache is still unanswered.

adelinor avatar Jan 26 '16 21:01 adelinor

Hallo @all Any update to @adelinor's problem. It seems like i am having the same problem and same Question. After installing private bower, i get a gitRepoCache but with no content. So how does this cache functions?

leacoco avatar Mar 23 '16 16:03 leacoco

@adelinor The gitRepoCache should contain clones of your dependencies. Is there any error on the console?

Hacklone avatar Mar 24 '16 16:03 Hacklone

@leacoco did you try it with the latest version?

Hacklone avatar Mar 24 '16 16:03 Hacklone

The gitRepoCache remains empty and there were no errors displayed in the console: this was for the version from Sept 2015

adelinor avatar Mar 24 '16 22:03 adelinor

Hallo Hacklone, yes i did try it with the latest version. But unfortunatly i am getting the same issue adelinor is facing. Been working on this for a while now but still not getting any solution to it. No errors, no cache. Another question: I have my docker image with private-bower running on a host ( say 1.1.1.1 ). Now my container exposes ports for private-bower 5678 6789 7891 and this ports are mapped to the host system.

My question is, how do i access cached artifacts from an external host say 2.2.2.2 ? first i modify my .bowerrc file on host 2.2.2.2 to include the following { "registry": "http://1.1.1.1:5678", "timeout": 300000 }

Assumming a dependency is being cached into the gitRepoCache which listens on port 6789 in the private-bower container. Trying to access this from 2.2.2.2, the request is made to localhost:6789 which is not accessible from outside the host.

leacoco avatar Mar 29 '16 04:03 leacoco

Can you please update me with the status of this issue? I am also having this problem with 1.1.6 version (private-bower cache not being updated; clients redirected to public repo instead of downloading from private-bower cache server)

durino13 avatar May 26 '16 05:05 durino13

Hallo @all, i finally got this working. The image @Hacklone provides works just fine, thanks. The problem i was facing was, i had my private bower image behind a Proxy and had to configure the proxy settings in bower-confg.json. I also had to configure my git to use the proxy as well ( git config --global http.proxy http://proxy:3128 )

Thanks once more.

leacoco avatar Jun 03 '16 21:06 leacoco