正在学习让我参加Bash教程的课程。 到目前为止,我被困在代码要求我发布代码的部分。我的指示如下:
What good is a package manager without packages? Not very good. Luckily, that is not a problem for npm, because it's very easy for all npm users to publish their modules and share them with the world. Packages get into the registry by using the `npm publish` command. Try it now. There's not much to it. (Make sure you're still in the right project directory, though. If you publish something by mistake, you can remove it, but there's no guarantee that no one saw it in the meantime.) Then run `how-to-npm verify` when you're done.
我的代码是:
jsf2008:~/workspace/dev (master) $ npm publish
npm ERR! publish Failed PUT 402
npm ERR! code E402
npm ERR! You must sign up for private packages : @jsf2008/quit
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2017-08-22T14_44_29_746Z-debug.log
jsf2008:~/workspace/dev (master) $
我在这里很丢失。我甚至无法在任何地方找到Error PUT 402。任何帮助将不胜感激。
答案 0 :(得分:76)
您正在使用NPM Scoped packages。默认情况下,它们是私有的,需要为私人帐户支付NPM。如果您的包是公开的,您可以使用--access=public
标志,如下所示:
npm publish --access=public
答案 1 :(得分:4)
首先创建组织:This question
然后运行npm publish --access public
答案 2 :(得分:0)
您可以通过将以下内容添加到您的 if (rootref1 != null) {
FirebaseRecyclerOptions<MessageMember> options1 =
new FirebaseRecyclerOptions.Builder<MessageMember>()
.setQuery(rootref1,MessageMember.class)
.build();
...
文件中来解决该问题:
package.json
package.json
publishConfig value 管理您的包的可见性。如果您定义了“公共”访问权限,那么每个人都可以从 npm 注册表中下载您的包。
如果您定义了“受限”访问,那么您的包的使用者必须将 "publishConfig": {
"access": "public"
}
文件添加到他们自己的包中以设置访问令牌:
.npmrc
.npmrc
注意:当您使用“公共”访问时,您不需要 always-auth=true
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
文件。