This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 744
Deploy a private npm registry in 5 minutes
fengmk2 edited this page Jan 10, 2016
·
20 revisions
- Node.js >= 4.2.3
- Linux or OSX
$ npm install -g --build-from-source cnpmjs.org cnpm sqlite3
If you're in China, maybe you should use China mirror
$ npm install -g --build-from-source \
--registry=https://registry.npm.taobao.org \
--disturl=https://npm.taobao.org/mirrors/node \
cnpmjs.org cnpm sqlite3
- admins:
myname,othername
- scopes:
my-company-name,other-name
- default ports: 7001-registry, 7002-web
$ nohup cnpmjs.org start --admins='myname,othername' \
--scopes='@my-company-name,@other-name' &
$ cnpm set registry http://localhost:7001
$ cnpm login
Username: myname
Password: ***
Email: (this IS public) m@fengmk2.com
Private package should be a scoped package
$ cd /tmp
$ mkdir helloworld && cd helloworld
$ cnpm init
name: (helloworld) @my-company-name/helloworld
version: (1.0.0)
{
"name": "@my-company-name/helloworld",
"version": "1.0.0",
"description": "my first scoped package",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
$ cnpm publish
+ @my-company-name/helloworld@1.0.0
You can visit with bowsers
$ open http://localhost:7002/@my-company-name/helloworld
Or use cnpm info
$ cnpm info
You can install all public packages from npmjs.org
$ cnpm install mocha
Copyright @ 2013 - present cnpmjs.org