我已经用npmjs.com创建了一个帐户,我还在遵循命令行(linux)中的“如何从npm到npm的教程”。我正处于发布测试模块的阶段。但我总是犯错误:
You must sign up for private packages : @zentech/node这些都是npm发布时的错误。
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"
}有人知道为什么会出错吗?谢谢
发布于 2017-09-20 16:28:04
您必须注册私有包:@zentech/node
所以要么注册,要么将包的名称从@zentech/node更改为公共名称,比如zentech-node。
发布于 2018-03-08 03:19:28
正如上面注释中所建议的那样,发布作用域包的方法是:
@scope/my-package是在发布时使用--访问标志。
npm publish --access=public您的不需要注册私有包,除非您实际上希望您的包是私有的。
发布于 2019-10-20 13:33:04
也可以在package.json上设置公共访问。
{
...
"publishConfig": {"access": "public"}
...
}而不是:
{
...
"publishConfig": {"access": "restricted"}
...
}https://stackoverflow.com/questions/46327239
复制相似问题