2017-09-20 71 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 

時,您需要簽署除非你真的希望你的軟件包是私人的,否則你需要私人軟件包。

相關問題