发布包到npm

1. Npm init

NPM init

2.package.json

{
  "name": "olivia-test-npm-first",
  "version": "1.0.1",
  "description": "Thisis testing first package.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}



3.Create index.js

创建入口文件

4. 创建脚本

创建脚本

5.登录NPM

输入用户名,密码,邮箱

npm login
Login

6. 发布包

npm publish
publish

7. Check package

check package

8. 安装包,进行测试

Testing

你可能感兴趣的:(发布包到npm)