How To Create An NPM Repository Mirror

17
10177

npmWe use Node.js a LOT, which means we do npm install a LOT. And npm is pretty terrible, with horrible dependency handling so we can end up requesting hundreds of dependent modules with it’s recursive patten e.g. for just one of our projects we can end up with paths like


./node_modules/bcrypt/node_modules/nodeunit/node_modules/should/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/sigmund/node_modules/tap/node_modules

[root@hmon workspace]# find . -name node_modules | wc -l
2103

That’s 2103 node_modules directories, for an application we’ve written that has only 22 dependencies configured for it!


[root@hmon workspace]# find . -name mocha | wc -l
59

There are 59 instances of the mocha module in the dependency chain, how is that for terrible reuse of code! Why can’t npm be nice like every other language out there, e.g. perl (hi cpan), PHP, Ruby (hi gems!) and Python??

npm does cache locally, but it kind of sucks.

Anyway, rant over, we want to create a mirror of the npm repository to mitigate periods of npm outages (occasionally it does have them) and hopefully speed things up a little bit, so here’s how I did it!

CouchDB

All the NPM data is stored in couchdb, I’m doing this on Centos so I’m going to use yum to install couchdb


[root@hmon etc]# yum install couchdb
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirror.linuxwerk.com
* epel: mirrors.n-ix.net
* extras: centos.mirror.linuxwerk.com
* passenger: passenger.stealthymonkeys.com
* rpmforge: mirror1.hs-esslingen.de
* rpmforge-extras: mirror1.hs-esslingen.de
* rpmforge-testing: mirror1.hs-esslingen.de
* updates: mirror.optimate-server.de
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package couchdb.x86_64 0:1.2.1-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================================
Installing:
couchdb x86_64 1.2.1-1 drum 1.1 M

Transaction Summary
=================================================================================================================================================================================================================
Install 1 Package(s)

Total download size: 1.1 M
Installed size: 3.0 M
Is this ok [y/N]: y
Downloading Packages:
couchdb-1.2.1-1.x86_64.rpm | 1.1 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : couchdb-1.2.1-1.x86_64 1/1
Verifying : couchdb-1.2.1-1.x86_64 1/1

Installed:
couchdb.x86_64 0:1.2.1-1

Complete!

Simples! Next step is to start it, confirm it’s listening on a port and test it works!


[root@hmon etc]# /etc/init.d/couchdb start
Starting database server couchdb
[root@hmon etc]# ps aux | grep couch
root 9790 0.0 0.0 106188 1532 pts/1 S 14:41 0:00 /bin/sh -e /opt/netdev/erlang/bin/couchdb -a /etc/couchdb/default.ini -a /etc/couchdb/local.ini -b -r 0 -p /var/run/couchdb/couchdb.pid -o couchdb.stdout -e couchdb.stderr -R
root 9800 0.0 0.0 106188 760 pts/1 S 14:41 0:00 /bin/sh -e /opt/netdev/erlang/bin/couchdb -a /etc/couchdb/default.ini -a /etc/couchdb/local.ini -b -r 0 -p /var/run/couchdb/couchdb.pid -o couchdb.stdout -e couchdb.stderr -R
root 9801 0.7 0.1 666732 18576 pts/1 Sl 14:41 0:00 /usr/lib64/erlang/erts-5.8.5/bin/beam.smp -Bd -K true -A 4 -- -root /usr/lib64/erlang -progname erl -- -home /root -- -noshell -noinput -os_mon start_memsup false start_cpu_sup false disk_space_check_interval 1 disk_almost_full_threshold 1 -sasl errlog_type error -couch_ini /etc/couchdb/default.ini /etc/couchdb/local.ini /etc/couchdb/default.ini /etc/couchdb/local.ini -s couch -pidfile /var/run/couchdb/couchdb.pid -heart
root 9834 0.0 0.0 103236 872 pts/1 S+ 14:42 0:00 grep couch
root 26078 0.0 0.0 173292 1720 ? S May07 0:00 sudo -u drum setsid node /opt/netdev/drum-collab-provisioning/server/server-couch.js
drum 26079 0.0 0.4 999360 70064 ? Ssl May07 18:09 node /opt/netdev/drum-collab-provisioning/server/server-couch.js
[root@hmon etc]# netstat -lpn | grep 9801
tcp 0 0 127.0.0.1:5984 0.0.0.0:* LISTEN 9801/beam.smp

At the moment in it’s default configuration it’s only listening on 127.0.0.1 so we want to fix that!

We also want to ensure that secure_rewrites is disabled else NPM will spit out loads of errors and not work!

In /etc/couchdb/local.ini we can override the default configuration, so we want to change


[httpd]
;port = 5984
;bind_address = 127.0.0.1

to


[httpd]
;port = 5984
bind_address = 0.0.0.0
secure_rewrites = false

and then restart couchdb with /etc/init.d/couchdb restart! Now we can see couchdb listening on all ports and test it with curl


[root@hmon couchdb]# netstat -lpn | grep 5984
tcp 0 0 0.0.0.0:5984 0.0.0.0:* LISTEN 10011/beam.smp
[root@hmon couchdb]# curl http://localhost:5984
{"couchdb":"Welcome","version":"1.2.1"}

Yay, we’re alive!!!

Setting Up CouchDB Replication

Now we need to tell couchdb that it needs to replicate from the NPM master in a continuous fashion, so as the NPM master updates, so does our couchdb instance!


[root@hmon couchdb]# curl -X POST http://127.0.0.1:5984/_replicate -d '{"source":"http://isaacs.iriscouch.com/registry/", "target":"registry", "continuous":true, "create_target":true}' -H "Content-Type: application/json"
{"ok":true,"_local_id":"d0818878c462afa6791440ab08348394+continuous+create_target"}

And we’re off! You can interrogate how the replcation is doing by visiting the server with a webbrowser at http://hostname:5984/_utils/ it should look a little like this:

couchdb-npm-mirror

Eventually it will stop growing, I promise πŸ˜‰ As of writing it’s just shy of 50GB

NPM Repository Mirror

Configuring NPM To Use Your Mirror

First we need to install some random npmjs stuff in to our couch database


git clone git://github.com/isaacs/npmjs.org.git
cd npmjs.org
sudo npm install -g couchapp
npm install couchapp
npm install semver
couchapp push registry/app.js http://localhost:5984/registry
couchapp push www/app.js http://localhost:5984/registry

Which looks a little bit like this


[root@hmon ~]# git clone git://github.com/isaacs/npmjs.org.git
Initialized empty Git repository in /root/npmjs.org/.git/
remote: Counting objects: 1291, done.
remote: Compressing objects: 100% (742/742), done.
remote: Total 1291 (delta 609), reused 1200 (delta 531)
Receiving objects: 100% (1291/1291), 649.70 KiB | 353 KiB/s, done.
Resolving deltas: 100% (609/609), done.
[root@hmon ~]# cd npmjs.org
[root@hmon npmjs.org]# npm install -g couchapp
npm http GET https://registry.npmjs.org/couchapp
npm http 304 https://registry.npmjs.org/couchapp
npm http GET https://registry.npmjs.org/watch
npm http GET https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/watch
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/aws-sign
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/cookie-jar
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/form-data/0.0.8
npm http 200 https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-4.0.0.tgz
npm http 200 https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.0.tgz
npm http 200 https://registry.npmjs.org/http-signature
npm http 200 https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/http-signature/-/http-signature-0.9.11.tgz
npm http GET https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz
npm http 200 https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/qs/-/qs-0.6.5.tgz
npm http 200 https://registry.npmjs.org/aws-sign
npm http GET https://registry.npmjs.org/aws-sign/-/aws-sign-0.3.0.tgz
npm http 200 https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz
npm http 200 https://registry.npmjs.org/cookie-jar
npm http GET https://registry.npmjs.org/cookie-jar/-/cookie-jar-0.3.0.tgz
npm http 200 https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.0.tgz
npm http 200 https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-4.0.0.tgz
npm http 200 https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.0.tgz
npm http 200 https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/mime/-/mime-1.2.9.tgz
npm http 200 https://registry.npmjs.org/form-data/0.0.8
npm http GET https://registry.npmjs.org/form-data/-/form-data-0.0.8.tgz
npm http 200 https://registry.npmjs.org/http-signature/-/http-signature-0.9.11.tgz
npm http 200 https://registry.npmjs.org/qs/-/qs-0.6.5.tgz
npm http 200 https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz
npm http 200 https://registry.npmjs.org/aws-sign/-/aws-sign-0.3.0.tgz
npm http 200 https://registry.npmjs.org/cookie-jar/-/cookie-jar-0.3.0.tgz
npm http 200 https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz
npm http 200 https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.0.tgz
npm http 200 https://registry.npmjs.org/mime/-/mime-1.2.9.tgz
npm http 200 https://registry.npmjs.org/form-data/-/form-data-0.0.8.tgz
npm http 200 https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/hawk/-/hawk-0.13.1.tgz
npm http 200 https://registry.npmjs.org/hawk/-/hawk-0.13.1.tgz
npm http GET https://registry.npmjs.org/assert-plus/0.1.2
npm http GET https://registry.npmjs.org/asn1/0.1.11
npm http GET https://registry.npmjs.org/ctype/0.5.2
npm http GET https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/boom
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/async
npm http 200 https://registry.npmjs.org/ctype/0.5.2
npm http 200 https://registry.npmjs.org/assert-plus/0.1.2
npm http 200 https://registry.npmjs.org/asn1/0.1.11
npm http 200 https://registry.npmjs.org/boom
npm http GET https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz
npm http GET https://registry.npmjs.org/boom/-/boom-0.4.2.tgz
npm http GET https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz
npm http GET https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz
npm http 200 https://registry.npmjs.org/cryptiles
npm http 200 https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.1.tgz
npm http GET https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.4.tgz
npm http 200 https://registry.npmjs.org/sntp
npm http 200 https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz
npm http 200 https://registry.npmjs.org/boom/-/boom-0.4.2.tgz
npm http GET https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz
npm http 200 https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz
npm http 200 https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz
npm http 200 https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.1.tgz
npm http 200 https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.4.tgz
npm http 200 https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz
npm http 200 https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/hoek/-/hoek-0.8.5.tgz
npm http 200 https://registry.npmjs.org/async
npm http 200 https://registry.npmjs.org/hoek/-/hoek-0.8.5.tgz
npm http GET https://registry.npmjs.org/async/-/async-0.2.9.tgz
npm http GET https://registry.npmjs.org/hoek
npm http 200 https://registry.npmjs.org/async/-/async-0.2.9.tgz
npm http GET https://registry.npmjs.org/delayed-stream/0.0.5
npm http 304 https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz
npm http 200 https://registry.npmjs.org/delayed-stream/0.0.5
npm http GET https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz
npm http 200 https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz
npm http 200 https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz
/root/.nvm/v0.8.15/bin/couchapp -> /root/.nvm/v0.8.15/lib/node_modules/couchapp/bin.js
couchapp@0.9.1 /root/.nvm/v0.8.15/lib/node_modules/couchapp
β”œβ”€β”€ watch@0.7.0
└── request@2.21.0 (json-stringify-safe@4.0.0, forever-agent@0.5.0, aws-sign@0.3.0, qs@0.6.5, tunnel-agent@0.3.0, oauth-sign@0.3.0, cookie-jar@0.3.0, node-uuid@1.4.0, mime@1.2.9, http-signature@0.9.11, hawk@0.13.1, form-data@0.0.8)
[root@hmon npmjs.org]# npm install couchapp
npm http GET https://registry.npmjs.org/couchapp
npm http 304 https://registry.npmjs.org/couchapp
npm http GET https://registry.npmjs.org/watch
npm http GET https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/watch
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/aws-sign
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/cookie-jar
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/form-data/0.0.8
npm http 304 https://registry.npmjs.org/json-stringify-safe
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/forever-agent
npm http 304 https://registry.npmjs.org/tunnel-agent
npm http 304 https://registry.npmjs.org/http-signature
npm http 304 https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/aws-sign
npm http 304 https://registry.npmjs.org/oauth-sign
npm http 304 https://registry.npmjs.org/cookie-jar
npm http 304 https://registry.npmjs.org/node-uuid
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/form-data/0.0.8
npm http GET https://registry.npmjs.org/assert-plus/0.1.2
npm http GET https://registry.npmjs.org/asn1/0.1.11
npm http GET https://registry.npmjs.org/ctype/0.5.2
npm http GET https://registry.npmjs.org/boom
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/ctype/0.5.2
npm http 304 https://registry.npmjs.org/asn1/0.1.11
npm http 304 https://registry.npmjs.org/assert-plus/0.1.2
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/hoek
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/combined-stream
npm http 304 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/delayed-stream/0.0.5
npm http 304 https://registry.npmjs.org/hoek
npm http 304 https://registry.npmjs.org/delayed-stream/0.0.5
couchapp@0.9.1 node_modules/couchapp
β”œβ”€β”€ watch@0.7.0
└── request@2.21.0 (json-stringify-safe@4.0.0, forever-agent@0.5.0, aws-sign@0.3.0, qs@0.6.5, tunnel-agent@0.3.0, oauth-sign@0.3.0, cookie-jar@0.3.0, node-uuid@1.4.0, mime@1.2.9, http-signature@0.9.11, hawk@0.13.1, form-data@0.0.8)
[root@hmon npmjs.org]# npm install semver
npm http GET https://registry.npmjs.org/semver
npm http 200 https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/semver/-/semver-1.0.14.tgz
npm http 200 https://registry.npmjs.org/semver/-/semver-1.0.14.tgz
semver@1.0.14 node_modules/semver
[root@hmon npmjs.org]# couchapp push registry/app.js http://localhost:5984/registry
Preparing.
Serializing.
PUT http://localhost:5984/registry/_design/scratch
Finished push. 1-8b4b7cde241179296b34d437d6fcbec3
[root@hmon npmjs.org]# couchapp push www/app.js http://localhost:5984/registry
Preparing.
Serializing.
PUT http://localhost:5984/registry/_design/ui
Finished push. 1-7d950267677c7a20ec944e4c8385af2f

Ok, now we should in theory have a completly working mirror repository of npm now!

Testing Your NPM Repository Mirror

Testing the npm repo mirror is easy enough, first we’ll make a request to the official repo then compare it to our server!


[root@hmon npmjs.org]# npm search cakes
NAME DESCRIPTION AUTHOR DATE KEYWORDS
mocha-cakes bdd stories add-on for mocha test framework with cucumber given/then/when syntax. =quangv 2012-06-03 15:30 mocha bdd stories cucumber test testing gherkin acceptance customer functional end-user
npm http GET https://registry.npmjs.org/-/all/since?stale=update_after&startkey=1371737099041
npm http 200 https://registry.npmjs.org/-/all/since?stale=update_after&startkey=1371737099041

Ok the official mirror has something called mocha-cakes in it, sounds delicious!


[root@hmon couchdb]# npm search cakes
npm http GET http://localhost:5984/registry/_design/app/_rewrite/-/all/since?stale=update_after&startkey=1371802019107
npm http 200 http://localhost:5984/registry/_design/app/_rewrite/-/all/since?stale=update_after&startkey=1371802019107
NAME DESCRIPTION AUTHOR DATE KEYWORDS
mocha-cakes bdd stories add-on for mocha test framework with cucumber given/then/when syntax. =quangv 2012-06-03 15:30 mocha bdd stories cucumber test testing gherkin acceptance customer functional end-user

And so does ours!!! It’s still syncing so I’m going to forgive that 404

Telling NPM To Use Our NPM Repository Mirror

We can either configure ~/.npmrc with


registry = http://localhost:5984/registry/_design/app/_rewrite

or set it on the command line with


npm config set registry http://localhost:5984/registry/_design/app/_rewrite

Bamo, a dozen commands later and now you too have your own working npm repository πŸ˜€

SHARE
Previous articleVolusion Review
Next articleNiche Site Duel 2 Participation
Hi, I'm Rus and after 10 years of Linux administration and software development, in September 2014 I quit my day job, sold all my stuff and moved to Thailand to live the good life. My new website, http://www.ruspow.com shows how I'm making money online as well as what life can be like when you're not sat behind a desk and are free to make your own decisions!
  • noam

    how much disk space does your mirror require?

    • rus

      Hey noam, it looks like we’re using around 92GB for the entire thing

      • Is it possible to store only your project’s dependencies on your mirror? And handle all updates manually?

        • alex

          Yes, it is possible to have only your project’s dependencies, take look at Sinopia server.

          It can be called a cache, or a private registry, but it can’t be called a mirror. By definition, mirror is when you copy the entire database.

          And when you really need it (like npmjs.eu does), that’s when CouchDB is used.

      • fergus

        Im up to nearly 200GB (and counting?) for the whole thing. There only seem to be about 51000 docs though. 200GB seems like a lot of storage for 51000 npm docs. Any tips? Does this seem wrong?

  • brian

    Hi, thanks for posting this. I’ve gone through the steps but I got an error when enter this command:

    couchapp push registry/app.js http://localhost:5984/registry

    Error: connect ECONNREFUSED
    at errnoException (net.js:901:11)
    at Object.afterConnect [as oncomplete] (net.js:892:19)

    Can you tell how I can get past this? Thanks.

    • rus

      is your couchdb instance up and listening on localhost:5984 ? What happens if you do

      telnet localhost 5984 ?

      does localhost correctly resolve to 127.0.0.1 ?

  • James

    I used some of the information on your post along with other details from another blog and the couchdb website to get my private mirror going. I’m still having issues with it getting completely updated. I used your “continuous: true” statement in the curl command and no updates are getting synced from the public repo. I’ve had to use ‘replicate http://isaacs.iriscouch.com/registry http://user:pass@localhost:5984/registry‘ ran manually to get new updates.

    • rus

      try creating a new document in _replicator like this : (i imagine wordpress is about to completely dick with the formating ..

      {
      “_id”: “registry-from-iriscouch”,
      “source”: “http://isaacs.iriscouch.com/registry/”,
      “target”: “registry”,
      “continuous”: true,
      “create_target”: true,
      “user_ctx”: {
      “name”: “admin”,
      “roles”: [
      “_admin”
      ]
      },
      “owner”: null
      }

  • Do

    How can I update the local repository from the public repository?

    • rus

      add the json pasted above your comment and ensure continuous is set to true

  • Gil Shinar

    Hi,

    I’m basically using CentOS but the procedure is exactly the same. At first I have tried it with couch 1.0.2 but then I found that it is too old. I have installed 1.6 from source and started replicating yesterday. Today I found it with 80.2GB so it seemed to be quiet full.

    When I run npm install I get a very long error message that starts like:

    0 info it worked if it ends with ok

    1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘search’, ‘cakes’ ]

    2 info using npm@1.4.21

    3 info using node@v0.10.30

    4 verbose request where is /registry/_design/app/_rewrite/-/all

    5 verbose request registry http://localhost:5984/

    6 verbose request id c8b97e2adb64803a

    7 verbose url raw /registry/_design/app/_rewrite/-/all

    8 verbose url resolving [ ‘http://localhost:5984/’,

    8 verbose url resolving ‘./registry/_design/app/_rewrite/-/all’ ]

    9 verbose url resolved http://localhost:5984/registry/_design/app/_rewrite/-/all

    10 verbose request where is http://localhost:5984/registry/_design/app/_rewrite/-/all

    11 info trying registry request attempt 1 at 12:11:05

    12 http GET http://localhost:5984/registry/_design/app/_rewrite/-/all

    13 http 500 http://localhost:5984/registry/_design/app/_rewrite/-/all

    14 info retry will retry, error on last attempt: Error: {{badarg,[{erlang,port_command,

    14 info retry [#Port,

    After the above error, starts a very long npm error message that I prefer not to paste here.
    Can someone please assist?

    Thanks
    Gil

    • Hi Gil,

      Unless you really need a complete clone of the NPM repository, I recommend using https://github.com/rlidwka/sinopia instead. It’s what I’ve since moved to since writing this document up. It’s a lot easier to set up, simpler to manage and doesn’t require syncing the entire NPM repository. Sinopia acts as a caching proxy that you can also push your own NPM packages to it’s a lot better!

      • Gil Shinar

        Hi,

        Have seen this before but still wanted to go on the complete clone.
        If I want be able to make it work, I’ll move to sinopia

        Thanks
        Gil

        • 13 http 500 http://localhost:5984/registry/_design/app/_rewrite/-/all
          This looks like CouchDB is throwing an internal error, is there anything in your CouchDB logs that could relate to it and shed more information on the problem?

          • Gil Shinar

            Hi,

            Good point. Looked at the DB log and found a very general error message with exit code 127.
            Looked at a different ubuntu tutorial and found that I need version 1.4.0 but this doesn’t work at all. CouchDB fails to start properly with a strange error. BTW, how do I delete data from the DB? When I have reinstalled 1.6.0, I saw that I still have 82GB of data in the in the registry DB.
            In your above tutorial, yum installs version 1.2.0 and when I install using yum I get only 1.0.2 so I have tried to install 1.2.0 from source but it fails to compile πŸ™
            What I’m trying to do now is to add all yum repos as you have and reinstall using yum. If I’ll get the 1.2.0, I’ll pray that it’ll start working properly. If not, I’ll have to move to sinopia although it is not the best solution for me.

            Thanks
            Gil

          • Gil Shinar

            Couldn’t make it work πŸ™
            No matter which repo I have added, couldn’t find apache-couchdb higher tan 1.0.4