2014-02-22 79 views
5

在宿醉(偉大計劃)時處理NPM模塊時,我遇到了錯誤的版本。 「沒問題」我想。 「我以前做過,並且使用npm unpublish <module>@<version>解決了。」我做到了這一點,並嘗試重新發布,但它拋出了錯誤「不能取代以前發佈的版本」,儘管這個版本不存在。嘗試使用NPM時發生錯誤發佈先前未發佈的版本

我決定去核。我的軟件包只有10個版本,所以我決定做npm unpublish <module> --force並從v0.0.1重新開始。我仍然得到「不能取代以前發佈的版本」。

幫助!!!我怎樣才能解決這個問題,以便我可以把我的包裹放回去?

錯誤日誌下面

npm publish v0.0.1.tar.gz 

npm http PUT https://registry.npmjs.org/datautils 
npm http 403 https://registry.npmjs.org/datautils 
npm http PUT https://registry.npmjs.org/datautils 
npm http 403 https://registry.npmjs.org/datautils 
npm ERR! publish Failed PUT 403 
npm ERR! Error: forbidden Cannot replace previously published version: 0.0.1: datautils 
npm ERR!  at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:275:14) 
npm ERR!  at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:123:22) 
npm ERR!  at Request.EventEmitter.emit (events.js:98:17) 
npm ERR!  at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:893:14) 
npm ERR!  at Request.EventEmitter.emit (events.js:117:20) 
npm ERR!  at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:844:12) 
npm ERR!  at IncomingMessage.EventEmitter.emit (events.js:117:20) 
npm ERR!  at _stream_readable.js:920:16 
npm ERR!  at process._tickCallback (node.js:415:13) 
npm ERR! If you need help, you may report this *entire* log, 
npm ERR! including the npm and node versions, at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 

npm ERR! System Linux 3.11.0-12-generic 
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "publish" "datautils-js-0.0.1.tar.gz" 
npm ERR! cwd /home/semms/Desktop/datautils 
npm ERR! node -v v0.10.25 
npm ERR! npm -v 1.3.24 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /home/semms/Desktop/datautils/npm-debug.log 
npm ERR! not ok code 0 

回答

8

你不能這樣做了。

https://github.com/npm/npmjs.org/issues/148

TLDR:當您取消發佈一個版本,然後發佈別的東西來代替,你可以打破別人的代碼,因此它是不好的。

+2

我看到這一點,並與邏輯同意你可以取消發佈的包。但是我已經能夠取消發佈軟件包(因此破壞了代碼)並且無法恢復。 – RiggerTheGeek

+0

的邏輯是:當你取消發佈軟件包/版本時,當有人'npm install'時,錯誤會立即彈出。當你替換它時,它將起作用,新的和不可靠的代碼可以投入生產。 – vkurchatkin

+0

完全同意@RiggerTheGeek。它不應該允許取消發佈。 – Yash

3

如果是小於24小時老

npm unpublish --force <package_name>@<version>

相關問題