Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【20161104】npm i git地址 & npm发布 #47

Closed
zhongxia245 opened this issue Nov 4, 2016 · 1 comment
Closed

【20161104】npm i git地址 & npm发布 #47

zhongxia245 opened this issue Nov 4, 2016 · 1 comment

Comments

@zhongxia245
Copy link
Owner

npm 安装包,如何使用 github 的地址

npm install <https://github.com/username/projectName/tarball/v0.0.1

tarball 需要固定,版本看自己情况。

//eg
npm install https://github.com/indexzero/forever/tarball/v0.5.6
@zhongxia245 zhongxia245 changed the title 【20161104】npm install git地址 【20161104】npm i git地址 & npm发布 Nov 4, 2016
@zhongxia245
Copy link
Owner Author

zhongxia245 commented Nov 4, 2016

如何发布 NPM包

1. 在 github 上创建一个仓库

2. 下载到本地

git clone  地址

3. 初始化npm

npm init

4. 创建一个 index.js

touch index.js 
//随便写点东西,eg:  console.log('hello npm!')

5. 注册一个npm用户

注意注意: 这里必须使用 npm 源, 切换回 npm源, 不能使用 cnpm
推荐使用 nrm 来管理 npm 的源。

//打开 https://www.npmjs.com/  页面右上角 Sign Up 按操作注册

//到命令行 
npm adduser 
//输入帐号,密码,邮箱, 也就是 注册的那几个。

6. 发布

//版本自增1 , eg: 0.0.1 => 0.0.2
npm version patch

//发布
npm publish

7. 打开 https://www.npmjs.com/ 看是否看到包

私有包

npm包为这种名称的 @name/npmname

称之为 私有包,不对外公开,并且是需要钱的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant