2017-09-20 72 views
2

我已经在npmjs.com上创建了一个帐户,我也正在使用命令行(linux)的how-to-npm教程。我正处于应该发布测试模块的阶段。不过,我不断收到错误:为什么我无法将我的软件包发布到npmjs

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" 
} 

没有人知道为什么这个错误吗?感谢

+0

这个错误怎么样不清楚?看起来你还没有注册私人包裹。如果你想使用私人包,你必须注册。 –

+0

chech这个链接https://stackoverflow.com/questions/41981686/getting-error-402-while-publishing-package-using-npm – skr

回答

3

这是很清楚的:

You must sign up for private packages: @zentech/node

让你无论是注册,或者你从@zentech/node改变你的包的名称到一个公共的名称,如zentech-node

+0

我想发布一个公共包(这是第一次与节点)所以所有的错误都不熟悉。我是否需要将我的软件包重命名为zentech-node? – miatech

+0

让它工作..谢谢 – miatech

+2

@miatech什么是解决方案? –

1

如上方式意见建议发布一个作用域包即

@scope/my-package 

是使用--access标志发布

npm publish --access=public 

时,您需要签署除非你真的希望你的软件包是私人的,否则你需要私人软件包。

相关问题