{
"name": "@zixian/demo", // @xxx你当前账号的名称
"version": "0.0.2",
"description": "test",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "zixian",
"license": "ISC"
}
4. 登录
npm login
# 或者
npm adduser
Username 用户名
Password 密码 (密码输入是看不到的)
Email 邮箱
Enter one-time password 验证码
5. 发布
发布镜像 必须切换
npm set registry http://registry.npmjs.org
发布命令
# 普通包
npm publish
# @username/packageName
# username 你当前登录的用户名 必须保持一致
npm publish --access public
包名与npm账户不一致 当前登录账号 wuyanzhu
PS D:\study\npm\@zixian\demo> npm publish --access public
npm notice
npm notice 📦 @zixian/demo@1.0.0
npm notice === Tarball Contents ===
npm notice 27B index.js
npm notice 226B package.json
npm notice === Tarball Details ===
npm notice name: @zixian/demo
npm notice version: 1.0.0
npm notice filename: @zixian/demo-1.0.0.tgz
npm notice package size: 358 B
npm notice unpacked size: 285 B
npm notice shasum: 073c32b83a4b98ac898973f0f721a10f3beefda3
npm notice integrity: sha512-gm7KnVN+gYUd0[...]iPs5bdHt84yGQ==
npm notice total files: 3
npm notice
npm notice Publishing to https://registry.npmjs.org/
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@zixian%2fdemo - Scope not found
npm ERR! 404
npm ERR! 404 '@zixian/demo@1.0.0' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache\_logs\2022-05-17T07_47_22_410Z-debug-0.log
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)