Ubuntu NPM Private Library Build (npmjs.org official version)

Source: Internet
Author: User
Tags couchdb

Targetnpm.xxx.com Installing and pushing Nodejs packagesNpmui.xxx.com manages NODEJS packages that have been pushed Installing COUCHDB https://launchpad.net/~couchdb/+archive/ubuntu/stable There are 14.10 14.04 and 12.04 PPA addresses installed that are not discussed here Installing COUCHDB 1.6.1 1. Initialize access to "http://localhost:5984/_utils/"new name is Registry library 
Asynchronous synchronous official Nodejs module (can not be done)
 
2. Modify the configuration
/usr/local/etc/couchdb/local.ini[couch_httpd_auth] Public_fields = appdotnet, Avatar, Avatarmedium, AvatarLarge, date , email, fields, freenode, FullName, GitHub, homepage, name, roles, Twitter, type, _id, _rev users_db_public = True [httpd ] Bind_address = 0.0.0.0 secure_rewrites = False [Couchdb] delayed_commits = false [admins]admin = password

3. Upload NPM Program

git clone git://github.com/npm/npm-registry-couchapp cd npm-registry-couchapp sudo npm install-g couchapp npm Install NPM Start--npm-registry-couchapp:couch=http://admin:[email protected]:5984/registry npm run load-- Npm-registry-couchapp:couch=http://admin:[email protected]:5984/registry npm Run copy--npm-registry-couchapp:couch =http://admin:[email protected]:5984/registry couchapp push www/app.js http://admin:[email protected]:5984/registry

Here, push it up. Two Program Access address:

Http://localhost:5984/_utils/registry/_design/app/_rewrite

Http://localhost:5984/_utils/registry/_design/ui/_rewrite

Then simply point the registry to COUCHDB to operate the private NPM library:

NPM--registry http://localhost:5984/registry/_design/app/_rewrite Login npm--registry http://localhost:5984/ Registry/_design/app/_rewrite Publish My-repo
 

Private NPM has been built here, the link is long!

Then add the following in the/usr/local/etc/couchdb/default.ini file:

[Vhosts] 127.0.0.1:5984=/registry/_design/app/_rewrite127.0.0.2:5984=/registry/_design/ui/_rewrite
 

This time we can use http://127.0.0.1:5984 to replace the long link.

Then, the private NPM library does not have a module (return 404) through the npmjs.org to find, so write Nginx configuration as follows:

server {    listen  ;    server_name  NPM. xxx.com;    Location/{        proxy_set_header Host 127.0.0.1:5984;        Proxy_pass http://127.0.0.1:5984;        Proxy_intercept_errors on;        Error_page  404 = @fallback;    }    Location @fallback {        internal;        Proxy_set_header Host registry.npmjs.org;        Proxy_pass http://registry.npmjs.org;    }} server {    listen  ;    server_name  Npmui. xxx.com;    Location/{        proxy_set_header Host 127.0.0.2:5984;        Proxy_pass http://127.0.0.2:5984;    }}
Write at the end of here our private library has been built and we can add it in ~/.NPMRC
registry=http://npm.xxx.com/

We'll be able to use our private library.

NPM login #登录  admin password# into our private package catalog Perfect Package.json then NPM publish# deleted is npm unpublish  ***@0.0.0


Ubuntu NPM Private Library Build (npmjs.org official version)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.