正在学习让我参加Bash教程的课程.到目前为止,我被困在代码要求我发布代码的部分.我的说明如下:
Run Code Online (Sandbox Code Playgroud)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) $
Run Code Online (Sandbox Code Playgroud)
我在这里很迷茫.我甚至无法在任何地方找到Error PUT 402.任何帮助将不胜感激.
Ale*_*ack 83
您正在使用NPM Scoped软件包.默认情况下,它们是私有的,需要为私人帐户支付NPM.如果您的包是公共的,您可以使用这样的--access=public标志:
npm publish --access=public
Run Code Online (Sandbox Code Playgroud)
Ben*_*uer 19
您可以通过将以下内容添加到package.json文件中来解决该问题:
包.json
"publishConfig": {
"access": "public"
}
Run Code Online (Sandbox Code Playgroud)
publishConfig值管理包的可见性。如果您定义“公共”访问权限,那么每个人都可以从 npm 注册表下载您的包。
如果您定义“受限”访问,则包的使用者必须将.npmrc文件添加到自己的包中才能设置访问令牌:
.npmrc
always-auth=true
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Run Code Online (Sandbox Code Playgroud)
注意:.npmrc使用“公共”访问权限时不需要该文件。
| 归档时间: |
|
| 查看次数: |
6600 次 |
| 最近记录: |