npm / npm-registry-client

http://npm.im/npm-registry-client
ISC License
264 stars 108 forks source link

unable to publish in private npm with npm-registry-client of version 0.3.3 #38

Closed benhakunamatata closed 10 years ago

benhakunamatata commented 10 years ago

We cannot publish the tarball to our private npm with version npm-registry-client of version 0.3.3

But it works fine wither version 0.2.30 of npm-registry-client

after debuging we found that in publish.js the "attach.call" was replaced by "putNext.call",

// attach.call(this, data.name, mytarball, tbName, rev, function (er) { // if (er) return handle.call(this, er) // this.log.verbose("publish", "attached", [data.name, mytarball, tbName]) // this.request("PUT", dataURI, data, function (er) { // if (er) return handle.call(this, er) // return cb(er) // }.bind(this)) // }.bind(this))

  putNext.call(this, data.version, root, current, cb)

If we use the commented "attach.call" , it will work fine. But it will not work with putNext.call which lead to error message on npm sever: {"error":"not_found","reason":"Document is missing attachment"}

Any idea about this? Do we need to change couchdb?

Thanks a lot. Ben

isaacs commented 10 years ago

What error are you seeing?

benhakunamatata commented 10 years ago

hello, issacs, thanks a lot for checking the issue.

there is no apparent error. Here is the input and output. input for this.request("PUT", root.name, current, cb) in method function putNext(newVersion, root, current, cb)

root.name: matatahello
current:
 { _id: 'matatahello',
  _rev: '52-9fb6f98f94914deae77cc181fdfa210e',
  name: 'matatahello',
  description: 'hello =====',
  'dist-tags': { latest: '0.7.11-SNAPSHOT' },
  versions: 
   { '0.6.0-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.6.0-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.6.0-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.17',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.6.1-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.6.1-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.6.1-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.1-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.1-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.1-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.2-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.2-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.2-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.3-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.3-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.3-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.4-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.4-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.4-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.17',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.5-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.5-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.5-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.7-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.7-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.7-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.9-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.9-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.9-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.10-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.10-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.10-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object],
        directories: {} },
     '0.7.11-SNAPSHOT': 
      { name: 'matatahello',
        version: '0.7.11-SNAPSHOT',
        description: 'hello =====',
        main: 'lib/index.js',
        scripts: [Object],
        repository: [Object],
        author: '',
        license: 'ISC',
        xxxinc: {},
        readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
        readmeFilename: 'README.md',
        _id: 'matatahello@0.7.11-SNAPSHOT',
        dist: [Object],
        _from: '.',
        _npmVersion: '1.3.21',
        _npmUser: [Object],
        maintainers: [Object] } },
  readme: 'hello\n=====\n\nhello world\n\n\nnpm test\n\n',
  maintainers: [ { name: 'weimama', email: 'weima@xxxinc.com' } ],
  time: 
   { '0.6.0-SNAPSHOT': '2014-01-25T00:12:05.570Z',
     '0.6.1-SNAPSHOT': '2014-01-25T00:14:45.352Z',
     '0.7.1-SNAPSHOT': '2014-01-27T18:33:11.404Z',
     '0.7.2-SNAPSHOT': '2014-01-27T19:02:37.601Z',
     '0.7.3-SNAPSHOT': '2014-01-27T19:09:45.391Z',
     '0.7.4-SNAPSHOT': '2014-01-27T19:32:20.880Z',
     '0.7.5-SNAPSHOT': '2014-01-27T19:35:03.049Z',
     '0.7.7-SNAPSHOT': '2014-01-27T21:41:50.414Z',
     '0.7.9-SNAPSHOT': '2014-01-27T22:42:18.405Z',
     '0.7.10-SNAPSHOT': '2014-02-03T18:03:21.797Z' },
  repository: 
   { type: 'git',
     url: 'git@github.scm.corp.xxxinc.com:weima/hello.git' },
  _attachments: 
   { 'matatahello-0.7.4-SNAPSHOT.tgz': 
      { content_type: 'application/octet-stream',
        revpos: 17,
        digest: 'md5-KPETMnLlGGBllXTWr/jp0g==',
        length: 1091,
        stub: true },
     'matatahello-0.6.0-SNAPSHOT.tgz': 
      { content_type: 'application/octet-stream',
        revpos: 2,
        digest: 'md5-A2mm4p2erxN/gyK10meHuw==',
        length: 1061,
        stub: true },
     'matatahello-0.7.11-SNAPSHOT.tgz': 
      { content_type: 'application/octet-stream',
        data: 'H4sIAAAAAAAAA+2a3W7bNhiGPaAbMB71EjSfxAE2maQoMW4hYFmbIQW2Nqh7sqNBtmhbiyxq+kmcDQF2B9vl7HCXsDvZDnc4UpIt2vKCDv6J0/ANYtnf95mkZPPVI1oX3uyceT5LurE3vPTGbL41f0h51NqKIIQOIUbrF/H8409+/UtuW2ILCyELO0YLYUwtalNKSQsi24HYaM220/3dytPMS8QQN22n3BljsX0gQj3j9ZuXZ+9O35o+i7OJiwAmi9CIhyG/dkdemDJgOYt4MI54wr4OQpaa0DWjeFpG/qsGueY4yOY1J2trsKt+89SW5vHImzJ36mXib8LEwACxGjVXLEkDHrnQpCZCX/Rfn170z9+8W1fqs3SYBHEmy4v2DFcKWLRROvWCyA2DQTeIfDYTAwRWs72ytdTMWJqJVnqNgoTFPA0yntyY2U3MXHFIAL2zLE9CWfWl+J/kA9HD1BzyJDbZwLsRz6bPrlkw9brF6OURBrg5di/PJjwRA0KNVBgMWZQy91X/BcA9I/bE57/OBgCu31uMXH5iAFtG/8X5q2++E0fyykWOmLsYUYBO5uEoDKJL8YVC1MgD30UIwp6D7Z4MjJcCylduEF6mwU/MJSIl41VbQcRdC1JiEXpCAMJGUWRBC2CovJcPL1P3BNz3rHo42p3r11L9/0nl/08X/g+JTVf933JsUb+xJ7+PHrn//wwMoy2Ntf3MaCve2v5cJio3lbkVQy3zioXKGsVFy7z0TZlQrbPMVGYpknIEIiBdU5a2xcvboqT2QaVKuI+sEl5XtCNCwiOryHvbZN1HaY5Fv8XryhFlQJhiGZOtyBHcgtsPz1guGvxXn8231Yc6/1vV/P9U5T+rnP/QdiyH2pL/LEg0/+1Dmv80/5X8R5f5T/lQD4v+bIBQSX+IaPjbVLtz/Vqq//9d+f+fNf9B5Kz6P8EYav7bhyLus++n3M+FBQM9dR6dmvz39uz05bdn5tTfWh/q/L9Yt/6Hy/mPbExsXMx/x9Hrf3uR5j/NfyX/Ocv8t7CBA8M/Z4F/FtX4t7F25/q1VP+fVf7/ROE/Yq/6P6aOo/lvHyqNtDQ+ULrgNU9CHwAgXN2QXqax8ANWk//mp7jt9aHO/6d38B+GBFFCJf9RG2n+24c0/2n+K/nPXua/xZ4eFv7RxW+/yLI1/22s3bl+LdX/P6r8/4+a/zCkq/5vYXn9r/lv9xryKOWhsAI+7hxNgqPj5wB0u2rUGGTc67RjL00FGfrtY1ly5SXGIB8ZrhGxa+OrfDRiSVnTFmmZTUVOVJgZ72dJEI077YGXMofIvNp8KpvTk/a+1OQ/9TS3nT7U+f/7Ov6zV9f/HRHW/LcPNfgPa/57nPy3cv/f0t4eFgP2FkuAJ1gj4GbanevXUv3/t8r//6n5D82v/5Xffy2i+W8vkqhWmZ/BZjFPsvR5tRBoxoLbMhEf5dFQumTnWN6Ft0yM9YrhZ5IdbzXKPSw1+U+evooHZGazbBt9rLv/b4n/aJP/HKj5bx/S/Kf5r+A/kV7iv2UbOCwC7KEFATo9TYCbaHeuX+tu/4cINq7/CYL6/r+9qElzR/P1vYlAv4T9mAcJ6xyZZn2JUFRMSjzsyOf3vRNaWlpaWv9b/wIN3SXNAEAAAA==',
        length: 1231 } },
  _etag: '"42T62YNGUM8VH50RWL1IPJQ02"' }
npm http PUT http://registry.npmjs.dev.xxxinc.com:5984/matatahello

and the output of the response is

---response---
{ _readableState: 
   { highWaterMark: 16384,
     buffer: [],
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: false,
     ended: true,
     endEmitted: true,
     reading: false,
     calledRead: true,
     sync: false,
     needReadable: true,
     emittedReadable: false,
     readableListening: false,
     objectMode: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: false,
  domain: null,
  _events: 
   { end: [ [Function: responseOnEnd], [Function], [Function] ],
     readable: [Function],
     close: [ [Function], [Function] ],
     data: [Function] },
  _maxListeners: 10,
  socket: 
   { _connecting: false,
     _handle: 
      { fd: 11,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _readableState: 
      { highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: false,
        ended: false,
        endEmitted: false,
        reading: true,
        calledRead: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        objectMode: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events: 
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        free: [Function],
        close: [Object],
        agentRemove: [Function],
        drain: [Function: ondrain] },
     _maxListeners: 10,
     _writableState: 
      { highWaterMark: 16384,
        objectMode: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        sync: false,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        buffer: [] },
     writable: true,
     allowHalfOpen: false,
     onend: null,
     destroyed: false,
     errorEmitted: false,
     bytesRead: 282,
     _bytesDispatched: 10888,
     _pendingData: null,
     _pendingEncoding: '',
     parser: null,
     _httpMessage: 
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: true,
        sendDate: false,
        _headerSent: true,
        _header: 'PUT /matatahello HTTP/1.1\r\ncookie: AuthSession=d2VpbWFtYTo1MkU2QTY1MjrDGGFAor8Fj-9ooRsWVuLdr08lxQ\r\naccept: application/json\r\nuser-agent: node/v0.10.24 darwin x64\r\nhost: registry.npmjs.dev.xxxinc.com:5984\r\ncontent-type: application/json\r\ncontent-length: 10604\r\nConnection: keep-alive\r\n\r\n',
        _hasBody: true,
        _trailer: '',
        finished: true,
        _hangupClose: false,
        socket: [Circular],
        connection: [Circular],
        agent: [Object],
        socketPath: undefined,
        method: 'PUT',
        path: '/matatahello',
        _headers: [Object],
        _headerNames: [Object],
        parser: null,
        res: [Circular] },
     ondata: null },
  connection: 
   { _connecting: false,
     _handle: 
      { fd: 11,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _readableState: 
      { highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: false,
        ended: false,
        endEmitted: false,
        reading: true,
        calledRead: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        objectMode: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events: 
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        free: [Function],
        close: [Object],
        agentRemove: [Function],
        drain: [Function: ondrain] },
     _maxListeners: 10,
     _writableState: 
      { highWaterMark: 16384,
        objectMode: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        sync: false,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        buffer: [] },
     writable: true,
     allowHalfOpen: false,
     onend: null,
     destroyed: false,
     errorEmitted: false,
     bytesRead: 282,
     _bytesDispatched: 10888,
     _pendingData: null,
     _pendingEncoding: '',
     parser: null,
     _httpMessage: 
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: true,
        sendDate: false,
        _headerSent: true,
        _header: 'PUT /matatahello HTTP/1.1\r\ncookie: AuthSession=d2VpbWFtYTo1MkU2QTY1MjrDGGFAor8Fj-9ooRsWVuLdr08lxQ\r\naccept: application/json\r\nuser-agent: node/v0.10.24 darwin x64\r\nhost: registry.npmjs.dev.xxxinc.com:5984\r\ncontent-type: application/json\r\ncontent-length: 10604\r\nConnection: keep-alive\r\n\r\n',
        _hasBody: true,
        _trailer: '',
        finished: true,
        _hangupClose: false,
        socket: [Circular],
        connection: [Circular],
        agent: [Object],
        socketPath: undefined,
        method: 'PUT',
        path: '/matatahello',
        _headers: [Object],
        _headerNames: [Object],
        parser: null,
        res: [Circular] },
     ondata: null },
  httpVersion: '1.1',
  complete: true,
  headers: 
   { 'x-couch-update-newrev': '53-2e45ec2f750e9abf2144108eec1e1ff1',
     'x-couch-id': 'matatahello',
     server: 'CouchDB/1.3.0 (Erlang OTP/R14B04)',
     date: 'Mon, 03 Feb 2014 18:15:45 GMT',
     'content-type': 'text/html; charset=utf-8',
     'content-length': '33' },
  trailers: {},
  _pendings: [],
  _pendingIndex: 0,
  url: '',
  method: null,
  statusCode: 201,
  client: 
   { _connecting: false,
     _handle: 
      { fd: 11,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _readableState: 
      { highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: false,
        ended: false,
        endEmitted: false,
        reading: true,
        calledRead: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        objectMode: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events: 
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        free: [Function],
        close: [Object],
        agentRemove: [Function],
        drain: [Function: ondrain] },
     _maxListeners: 10,
     _writableState: 
      { highWaterMark: 16384,
        objectMode: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        sync: false,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        buffer: [] },
     writable: true,
     allowHalfOpen: false,
     onend: null,
     destroyed: false,
     errorEmitted: false,
     bytesRead: 282,
     _bytesDispatched: 10888,
     _pendingData: null,
     _pendingEncoding: '',
     parser: null,
     _httpMessage: 
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: true,
        sendDate: false,
        _headerSent: true,
        _header: 'PUT /matatahello HTTP/1.1\r\ncookie: AuthSession=d2VpbWFtYTo1MkU2QTY1MjrDGGFAor8Fj-9ooRsWVuLdr08lxQ\r\naccept: application/json\r\nuser-agent: node/v0.10.24 darwin x64\r\nhost: registry.npmjs.dev.xxxinc.com:5984\r\ncontent-type: application/json\r\ncontent-length: 10604\r\nConnection: keep-alive\r\n\r\n',
        _hasBody: true,
        _trailer: '',
        finished: true,
        _hangupClose: false,
        socket: [Circular],
        connection: [Circular],
        agent: [Object],
        socketPath: undefined,
        method: 'PUT',
        path: '/matatahello',
        _headers: [Object],
        _headerNames: [Object],
        parser: null,
        res: [Circular] },
     ondata: null },
  _consuming: true,
  _dumped: false,
  httpVersionMajor: 1,
  httpVersionMinor: 1,
  upgrade: false,
  req: 
   { domain: null,
     _events: { error: [Function], drain: [Function] },
     _maxListeners: 10,
     output: [],
     outputEncodings: [],
     writable: true,
     _last: false,
     chunkedEncoding: false,
     shouldKeepAlive: true,
     useChunkedEncodingByDefault: true,
     sendDate: false,
     _headerSent: true,
     _header: 'PUT /matatahello HTTP/1.1\r\ncookie: AuthSession=d2VpbWFtYTo1MkU2QTY1MjrDGGFAor8Fj-9ooRsWVuLdr08lxQ\r\naccept: application/json\r\nuser-agent: node/v0.10.24 darwin x64\r\nhost: registry.npmjs.dev.xxxinc.com:5984\r\ncontent-type: application/json\r\ncontent-length: 10604\r\nConnection: keep-alive\r\n\r\n',
     _hasBody: true,
     _trailer: '',
     finished: true,
     _hangupClose: false,
     socket: 
      { _connecting: false,
        _handle: [Object],
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: 10,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: false,
        onend: null,
        destroyed: false,
        errorEmitted: false,
        bytesRead: 282,
        _bytesDispatched: 10888,
        _pendingData: null,
        _pendingEncoding: '',
        parser: null,
        _httpMessage: [Circular],
        ondata: null },
     connection: 
      { _connecting: false,
        _handle: [Object],
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: 10,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: false,
        onend: null,
        destroyed: false,
        errorEmitted: false,
        bytesRead: 282,
        _bytesDispatched: 10888,
        _pendingData: null,
        _pendingEncoding: '',
        parser: null,
        _httpMessage: [Circular],
        ondata: null },
     agent: 
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        options: [Object],
        requests: {},
        sockets: [Object],
        maxSockets: 5,
        createConnection: [Function] },
     socketPath: undefined,
     method: 'PUT',
     path: '/matatahello',
     _headers: 
      { cookie: 'AuthSession=d2VpbWFtYTo1MkU2QTY1MjrDGGFAor8Fj-9ooRsWVuLdr08lxQ',
        accept: 'application/json',
        'user-agent': 'node/v0.10.24 darwin x64',
        host: 'registry.npmjs.dev.xxxinc.com:5984',
        'content-type': 'application/json',
        'content-length': 10604 },
     _headerNames: 
      { cookie: 'cookie',
        accept: 'accept',
        'user-agent': 'user-agent',
        host: 'host',
        'content-type': 'content-type',
        'content-length': 'content-length' },
     parser: null,
     res: [Circular] },
  pipe: [Function],
  addListener: [Function],
  on: [Function],
  pause: [Function],
  resume: [Function],
  read: [Function],
  request: 
   { domain: null,
     _events: 
      { error: [Object],
        complete: [Function],
        pipe: [Function],
        socket: [Function],
        end: [Object],
        data: [Function] },
     _maxListeners: 10,
     readable: true,
     writable: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uotZFKMfH0vq4idGhs6dOcRmQafiFSNrVkfB7cVT\n5NSAH2v6gEaYsgmmD5W+ZoiTAgMBAAGjggElMIIBITAOBgNVHQ8BAf8EBAMCAQYw\nEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUXUayjcRLdBy77fVztjq3OI91\nnn4wRwYDVR0gBEAwPjA8BgRVHSAAMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8vd3d3\nLmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMDMGA1UdHwQsMCowKKAmoCSGImh0\ndHA6Ly9jcmwuZ2xvYmFsc2lnbi5uZXQvcm9vdC5jcmwwPQYIKwYBBQUHAQEEMTAv\nMC0GCCsGAQUFBzABhiFodHRwOi8vb2NzcC5nbG9iYWxzaWduLmNvbS9yb290cjEw\nHwYDVR0jBBgwFoAUYHtmGkUNl8qJUC99BM00qP/8/UswDQYJKoZIhvcNAQEFBQAD\nggEBABvgiADHBREc/6stSEJSzSBo53xBjcEnxSxZZ6CaNduzUKcbYumlO/q2IQen\nfPMOK25+Lk2TnLryhj5jiBDYW2FQEtuHrhm70t8ylgCoXtwtI7yw07VKoI5lkS/Z\n9oL2dLLffCbvGSuXL+Ch7rkXIkg/pfcNYNUNUUflWP63n41edTzGQfDPgVRJEcYX\npOBWYdw9P91nbHZF2krqrhqkYE/Ho9aqp9nNgSvBZnWygI/1h01fwlr1kMbawb30\nhag8IyrhFHvBN91i0ZJsumB9iOQct+R2UTjEqUdOqCsukNK1OFHrwZyKarXMsh3o\nwFZUTKiL8IkyhtyTMr5NGvo1dbU=\n-----END CERTIFICATE-----\n' ],
     localAddress: undefined,
     cert: null,
     key: null,
     strictSSL: true,
     headers: 
      { cookie: 'AuthSession=d2VpbWFtYTo1MkU2QTY1MjrDGGFAor8Fj-9ooRsWVuLdr08lxQ',
        accept: 'application/json',
        'user-agent': 'node/v0.10.24 darwin x64',
        'content-type': 'application/json',
        'content-length': 10604 },
     proxy: null,
     callback: [Function],
     explicitMethod: true,
     canTunnel: 
      { httpOverHttp: [Function: httpOverHttp],
        httpsOverHttp: [Function: httpsOverHttp],
        httpOverHttps: [Function: httpOverHttps],
        httpsOverHttps: [Function: httpsOverHttps],
        debug: [Function] },
     pool: { 'http:': [Object] },
     dests: [],
     __isRequestRequest: true,
     _callback: [Function],
     uri: 
      { protocol: 'http:',
        slashes: true,
        auth: null,
        host: 'registry.npmjs.dev.xxxinc.com:5984',
        port: '5984',
        hostname: 'registry.npmjs.dev.xxxinc.com',
        hash: null,
        search: null,
        query: null,
        pathname: '/matatahello',
        path: '/matatahello',
        href: 'http://registry.npmjs.dev.xxxinc.com:5984/matatahello' },
     _redirectsFollowed: 0,
     maxRedirects: 10,
     followRedirect: true,
     followAllRedirects: false,
     redirects: [],
     setHost: true,
     originalCookieHeader: 'AuthSession=d2VpbWFtYTo1MkU2QTY1MjrDGGFAor8Fj-9ooRsWVuLdr08lxQ',
     _disableCookies: true,
     _jar: undefined,
     port: '5984',
     host: 'registry.npmjs.dev.xxxinc.com',
     clientErrorHandler: [Function],
     _parserErrorHandler: [Function],
     path: '/matatahello',
     _json: true,
     body: <Buffer 7b 22 5f 69 64 22 3a 22 6d 61 74 61 74 61 68 65 6c 6c 6f 22 2c 22 5f 72 65 76 22 3a 22 35 32 2d 39 66 62 36 66 39 38 66 39 34 39 31 34 64 65 61 65 37 37 ...>,
     httpModule: 
      { parsers: [Object],
        STATUS_CODES: [Object],
        IncomingMessage: [Object],
        OutgoingMessage: [Object],
        ServerResponse: [Object],
        Agent: [Object],
        globalAgent: [Object],
        ClientRequest: [Object],
        request: [Function],
        get: [Function],
        Server: [Object],
        createServer: [Function],
        _connectionListener: [Function: connectionListener],
        Client: [Function: deprecated],
        createClient: [Function: deprecated] },
     agentClass: { [Function: Agent] super_: [Object], defaultMaxSockets: 5 },
     agent: 
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        options: [Object],
        requests: {},
        sockets: [Object],
        maxSockets: 5,
        createConnection: [Function] },
     _started: true,
     href: 'http://registry.npmjs.dev.xxxinc.com:5984/matatahello',
     req: 
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: true,
        sendDate: false,
        _headerSent: true,
        _header: 'PUT /matatahello HTTP/1.1\r\ncookie: AuthSession=d2VpbWFtYTo1MkU2QTY1MjrDGGFAor8Fj-9ooRsWVuLdr08lxQ\r\naccept: application/json\r\nuser-agent: node/v0.10.24 darwin x64\r\nhost: registry.npmjs.dev.xxxinc.com:5984\r\ncontent-type: application/json\r\ncontent-length: 10604\r\nConnection: keep-alive\r\n\r\n',
        _hasBody: true,
        _trailer: '',
        finished: true,
        _hangupClose: false,
        socket: [Object],
        connection: [Object],
        agent: [Object],
        socketPath: undefined,
        method: 'PUT',
        path: '/matatahello',
        _headers: [Object],
        _headerNames: [Object],
        parser: null,
        res: [Circular] },
     ntick: true,
     response: [Circular],
     _destdata: true,
     _ended: true,
     _callbackCalled: true },
  toJSON: [Function: toJSON],
  body: { ok: 'updated package metadata' } }
npm http 201 http://registry.npmjs.dev.xxxinc.com:5984/matatahello
+ matatahello@0.7.11-SNAPSHOT
isaacs commented 10 years ago

Ok... so, it looks like you're dumping out some extra stuff, but it is working?

When you use the current version of npm-registry-client, and you do npm publish, what happens?

benhakunamatata commented 10 years ago

It is not working. when accessing the tar file from the npm registry. {"error":"not_found","reason":"Document is missing attachment"}

But from the above input/output, there is no apparent error message , when calling request with "PUT" method.

But the input parameters seems different, not sure whether this could cause the problem.

isaacs commented 10 years ago

@benhakunamatata That would indicate that the publish didn't upload a tar file. Are you providing a tarball when you upload?

Look at how npm does it. Or better yet, just use npm.

I'm sorry, but without much more information (and free time, and access to your server) I'm afraid there's no way I can debug this further. Can you publish to your private registry with npm? Does that work?

burkostya commented 10 years ago

I have same issue. Works fine for node v0.10.23, but fails for versions above.

> cd ~/dev/modules/scikit-zero/
> node -v
v0.10.25
> npm -v
1.3.24
> npm version patch
v0.1.5
> npm publish
npm http PUT http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http 409 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http GET http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http 200 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http PUT http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http 201 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
+ scikit-zero@0.1.5
> cd /tmp
> npm install scikit-zero@0.1.5
npm http GET http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/0.1.5
npm http 200 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/0.1.5
npm http GET http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/-/scikit-zero-0.1.5.tgz
npm http 404 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/-/scikit-zero-0.1.5.tgz
npm ERR! fetch failed http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/-/scikit-zero-0.1.5.tgz
npm ERR! Error: 404 Not Found
npm ERR!     at WriteStream.<anonymous> (/home/revers/.n/lib/node_modules/npm/lib/utils/fetch.js:57:12)
npm ERR!     at WriteStream.EventEmitter.emit (events.js:117:20)
npm ERR!     at fs.js:1596:14
npm ERR!     at /home/revers/.n/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:103:5
npm ERR!     at Object.oncomplete (fs.js:107:15)
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.12.7-2-ARCH
npm ERR! command "/home/revers/.n/bin/node" "/home/revers/.n/bin/npm" "install" "scikit-zero@0.1.5"
npm ERR! cwd /tmp
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!     /tmp/npm-debug.log
npm ERR! not ok code 0
> cd ~/dev/modules/scikit-zero/
> n 0.10.23
> node -v
v0.10.23
> npm -v
1.3.17
> npm version patch
v0.1.6
> npm publish
npm http PUT http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http 409 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http GET http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http 200 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero
npm http PUT http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/-/scikit-zero-0.1.6.tgz/-rev/7-f5ad214bc5ab77beef946fb23015b338
npm http 201 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/-/scikit-zero-0.1.6.tgz/-rev/7-f5ad214bc5ab77beef946fb23015b338
npm http PUT http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/0.1.6/-tag/latest
npm http 201 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/0.1.6/-tag/latest
+ scikit-zero@0.1.6
> cd /tmp
> npm install scikit-zero@0.1.6
npm http GET http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/0.1.6
npm http 200 http://npm:5984/registry/_design/scratch/_rewrite/scikit-zero/0.1.6
npm http GET http://<ip here>:5984/registry/_design/scratch/_rewrite/scikit-zero/-/scikit-zero-0.1.6.tgz
npm http 200 http://<ip here>:5984/registry/_design/scratch/_rewrite/scikit-zero/-/scikit-zero-0.1.6.tgz
scikit-zero@0.1.6 node_modules/scikit-zero