1.0.0 • Published 1 year ago
npm-test-gutai v1.0.0
用于测试npm上传功能。
1. 生成配置项 npm init
npm init
的配置项,也可以通过package.json
文件进行配置,具体package.json属性介绍请查看:https://docs.npmjs.com/cli/v8/configuring-npm/package-json
> npm init
package name: // 项目名称
version: (1.0.0) // 版本号,默认是1.0.0。对于npm包的版本号有着一系列的规则,模块的版本号采用X.Y.Z的格式,具体体现为
// 1、修复bug,小改动,增加z。
// 2、增加新特性,可向后兼容,增加y
// 3、有很大的改动,无法向下兼容,增加x
description: // 项目的描述
entry point: (index.js) // 入口文件,默认是Index.js,可以修改成自己的文件
test command: // 测试命令
git repository: // git仓库
keywords: // 关键字,可以通过关键字来搜索你的包
author: // 作者
license: (ISC) // 开源协议,也可以是MIT
2. npm adduser,第一次发布包(非第一次可忽略)
在终端输入npm adduser
,提示输入账号,密码和邮箱,然后将提示创建成功,具体如下图。 npm adduser
成功的时候默认你已经登陆了,非第一次登录使用npm login
,成功提示Logged in as gu_tai on https://registry.npmjs.org/.
当登录报错403时,
403 Forbidden - PUT https://registry.npmmirror.com/-/user/org.couchdb.user:gu_tai - FORBIDDEN Public registration is not allowed
切换npm镜像为npm官方的
npm config set registry https://registry.npmjs.org/
3. npm publish 发包
403 Forbidden - PUT https://registry.npmjs.org/npm-test - You do not have permission to publish "npm-test". Are you logged in as the correct user?
出现错误,包名重复,更换包名
1.0.0
1 year ago