为什么我无法将我的包发布到 npmjs
why I am unable to publish my package to npmjs
我已经使用 npmjs.com 创建了一个帐户,并且我正在从命令行 (linux) 关注 how-to-npm 教程。我正处于应该发布测试模块的阶段。但我不断收到错误消息:
You must sign up for private packages : @zentech/node
这些都是npm publish时的报错
npm ERR! publish Failed PUT 402
npm ERR! Linux 4.10.0-33-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "publish"
npm ERR! node v4.7.2
npm ERR! npm v3.5.2
npm ERR! code E402
npm ERR! You must sign up for private packages : @zentech/node
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/george/node/npm-debug.log
我的package.json文件
{
"name": "@zentech/node",
"version": "1.0.1",
"main": "index.js",
"preferGlobal": true,
"scripts": {
"test": "node test.js"
},
"author": "",
"license": "ISC",
"description": "",
"repository": "http://github.com/zentech/node"
}
有谁知道为什么会报错?谢谢
You must sign up for private packages: @zentech/node
所以您要么注册,要么将包裹名称从 @zentech/node
更改为 public 名称,例如 zentech-node
.
正如上面评论中所建议的那样发布范围包,即
@scope/my-package
就是在发布的时候使用--access标志
npm publish --access=public
您不需要注册私人包裹,除非您确实希望您的包裹是私人的。
或者您可以在 package.json
上设置 public 访问权限:
{
...
"publishConfig": {"access": "public"}
...
}
而不是:
{
...
"publishConfig": {"access": "restricted"}
...
}
我已经使用 npmjs.com 创建了一个帐户,并且我正在从命令行 (linux) 关注 how-to-npm 教程。我正处于应该发布测试模块的阶段。但我不断收到错误消息:
You must sign up for private packages : @zentech/node
这些都是npm publish时的报错
npm ERR! publish Failed PUT 402
npm ERR! Linux 4.10.0-33-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "publish"
npm ERR! node v4.7.2
npm ERR! npm v3.5.2
npm ERR! code E402
npm ERR! You must sign up for private packages : @zentech/node
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/george/node/npm-debug.log
我的package.json文件
{
"name": "@zentech/node",
"version": "1.0.1",
"main": "index.js",
"preferGlobal": true,
"scripts": {
"test": "node test.js"
},
"author": "",
"license": "ISC",
"description": "",
"repository": "http://github.com/zentech/node"
}
有谁知道为什么会报错?谢谢
You must sign up for private packages: @zentech/node
所以您要么注册,要么将包裹名称从 @zentech/node
更改为 public 名称,例如 zentech-node
.
正如上面评论中所建议的那样发布范围包,即
@scope/my-package
就是在发布的时候使用--access标志
npm publish --access=public
您不需要注册私人包裹,除非您确实希望您的包裹是私人的。
或者您可以在 package.json
上设置 public 访问权限:
{
...
"publishConfig": {"access": "public"}
...
}
而不是:
{
...
"publishConfig": {"access": "restricted"}
...
}