Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

npm publish fails with 'cb() never called!' if you are a non-authorized user to update module #3923

Closed
timfpark opened this Issue Sep 22, 2013 · 10 comments

Comments

Projects
None yet
7 participants

I was beating my head against the wall for hours before I figured out that I was logged into npm with the wrong user name. The ask in this bug is to improve the user visible response to let us know that the 403 to update the package means you aren't authorized and better look at why instead of failing with a 'cb() never called error'

To reproduce:

  1. publish a test module with user1 credentials.
  2. switch to user2 credentials
  3. attempt to publish a new version of the module

Result: Get cryptic error message.

Full -dd log:

Tims-MacBook-Air:client timpark$ npm publish -dd
npm info it worked if it ends with ok
npm verb cli [ 'node',
npm verb cli '/Users/timpark/.nvm/v0.10.18/bin/npm',
npm verb cli 'publish',
npm verb cli '-dd' ]
npm info using npm@1.2.32
npm info using node@v0.10.18
npm verb publish [ '.' ]
npm verb read json /Users/timpark/dev/nitrogen/client/package.json
npm verb cache add [ '.', null ]
npm verb cache add name=undefined spec="." args=[".",null]
npm verb parsed url { protocol: null,
npm verb parsed url slashes: null,
npm verb parsed url auth: null,
npm verb parsed url host: null,
npm verb parsed url port: null,
npm verb parsed url hostname: null,
npm verb parsed url hash: null,
npm verb parsed url search: null,
npm verb parsed url query: null,
npm verb parsed url pathname: '.',
npm verb parsed url path: '.',
npm verb parsed url href: '.' }
npm verb lock . /Users/timpark/.npm/3a52ce78-.lock
npm verb read json package.json
npm verb tar pack [ '/var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/tmp.tgz',
npm verb tar pack '.' ]
npm verb tarball /var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/tmp.tgz
npm verb folder .
npm info prepublish nitrogen@0.1.31
npm verb unsafe-perm in lifecycle true

nitrogen@0.1.31 prepublish .
scripts/build-module

info: (yuidoc): Starting YUIDoc@0.3.45 using YUI@3.9.1 with NodeJS@0.10.18
info: (yuidoc): Scanning for yuidoc.json file.
warn: (yuidoc): Skipping node_modules directory while scanning for yuidoc.json
info: (yuidoc): Loading package.json data from: /Users/timpark/dev/nitrogen/client/package.json
info: (yuidoc): Loading yuidoc.json data from: /Users/timpark/dev/nitrogen/client/yuidoc.json
info: (yuidoc): Starting YUIDoc with the following options:
info: (yuidoc):
{ linkNatives: 'true',
exclude: 'node_modules,browser',
outdir: 'docs',
port: 3000,
nocode: false,
paths: [ '.' ],
project:
{ logo: 'https://api.nitrogen.io/logo.png',
name: 'nitrogen',
version: '0.1.31' } }
info: (yuidoc): YUIDoc Starting from: .
warn: (yuidoc): Found out dir, deleting: docs
info: (yuidoc): Making out dir: docs
info: (yuidoc): Parsed 42 files in 0.036 seconds
info: (builder): Building..
info: (builder): Compiling Templates
info: (builder): Making default directories: classes,modules,files
info: (builder): Copying Assets
info: (builder): Rendering and writing 0 modules pages.
info: (builder): Finished writing module files
info: (builder): Rendering and writing 8 class pages.
info: (builder): Loading theme from /Users/timpark/.nvm/v0.10.18/lib/node_modules/yuidocjs/themes/default/theme.json
info: (builder): Preparing index.html
info: (builder): Writing API Meta Data
info: (builder): Finished writing class files
info: (builder): Rendering and writing 8 source files.
info: (builder): Writing index.html
info: (builder): Finished writing source files
info: (builder): Finished writing 17 files in 0.254 seconds
info: (yuidoc): Completed in 0.347 seconds
npm verb lock tar://. /Users/timpark/.npm/1f1177db-tar.lock
npm verb lock tar:///var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/tmp.tgz /Users/timpark/.npm/cc0aac88-24080-0-2560768239200115-tmp-tgz.lock
npm verb tar unpack /var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/tmp.tgz
npm verb lock tar:///var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/package /Users/timpark/.npm/d8225e38-24080-0-2560768239200115-package.lock
npm verb lock tar:///var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/tmp.tgz /Users/timpark/.npm/cc0aac88-24080-0-2560768239200115-tmp-tgz.lock
npm verb read json /var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/package/package.json
npm verb from cache /var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/package/package.json
npm verb tar pack [ '/Users/timpark/.npm/nitrogen/0.1.31/package.tgz',
npm verb tar pack '/var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/package' ]
npm verb tarball /Users/timpark/.npm/nitrogen/0.1.31/package.tgz
npm verb folder /var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/package
npm verb lock tar:///var/folders/g2/hjzw1dn927g9jt9b6l1zqdlw0000gn/T/npm-1914/1379867924080-0.2560768239200115/package /Users/timpark/.npm/d8225e38-24080-0-2560768239200115-package.lock
npm verb lock tar:///Users/timpark/.npm/nitrogen/0.1.31/package.tgz /Users/timpark/.npm/764a179f--npm-nitrogen-0-1-31-package-tgz.lock
npm verb lock /Users/timpark/.npm/nitrogen/0.1.31/package /Users/timpark/.npm/11f6ac45-park-npm-nitrogen-0-1-31-package.lock
npm verb tar unpack /Users/timpark/.npm/nitrogen/0.1.31/package.tgz
npm verb lock tar:///Users/timpark/.npm/nitrogen/0.1.31/package /Users/timpark/.npm/a2a22fe2-park-npm-nitrogen-0-1-31-package.lock
npm verb lock tar:///Users/timpark/.npm/nitrogen/0.1.31/package.tgz /Users/timpark/.npm/764a179f--npm-nitrogen-0-1-31-package-tgz.lock
npm verb read json /Users/timpark/.npm/nitrogen/0.1.31/package/package.json
npm verb from cache /Users/timpark/.npm/nitrogen/0.1.31/package/package.json
npm verb chmod /Users/timpark/.npm/nitrogen/0.1.31/package.tgz 644
npm verb chown /Users/timpark/.npm/nitrogen/0.1.31/package.tgz [ 501, 20 ]
npm verb url raw nitrogen
npm verb url resolving [ 'https://registry.npmjs.org/', './nitrogen' ]
npm verb url resolved https://registry.npmjs.org/nitrogen
npm info trying registry request attempt 1 at 09:38:46
npm http PUT https://registry.npmjs.org/nitrogen
npm http 409 https://registry.npmjs.org/nitrogen
npm verb url raw nitrogen
npm verb url resolving [ 'https://registry.npmjs.org/', './nitrogen' ]
npm verb url resolved https://registry.npmjs.org/nitrogen
npm info trying registry request attempt 1 at 09:38:46
npm http GET https://registry.npmjs.org/nitrogen
npm http 200 https://registry.npmjs.org/nitrogen
npm verb uploading [ 'nitrogen/-/nitrogen-0.1.31.tgz/-rev/218-4139df83332c12c816f55e1fd7e0ebf3',
npm verb uploading '/Users/timpark/.npm/nitrogen/0.1.31/package.tgz' ]
npm verb url raw nitrogen/-/nitrogen-0.1.31.tgz/-rev/218-4139df83332c12c816f55e1fd7e0ebf3
npm verb url resolving [ 'https://registry.npmjs.org/',
npm verb url resolving './nitrogen/-/nitrogen-0.1.31.tgz/-rev/218-4139df83332c12c816f55e1fd7e0ebf3' ]
npm verb url resolved https://registry.npmjs.org/nitrogen/-/nitrogen-0.1.31.tgz/-rev/218-4139df83332c12c816f55e1fd7e0ebf3
npm info trying registry request attempt 1 at 09:38:48
npm http PUT https://registry.npmjs.org/nitrogen/-/nitrogen-0.1.31.tgz/-rev/218-4139df83332c12c816f55e1fd7e0ebf3
npm http 403 https://registry.npmjs.org/nitrogen/-/nitrogen-0.1.31.tgz/-rev/218-4139df83332c12c816f55e1fd7e0ebf3
npm info trying registry request attempt 1 at 09:38:49
npm http PUT https://registry.npmjs.org/nitrogen/-/nitrogen-0.1.31.tgz/-rev/218-4139df83332c12c816f55e1fd7e0ebf3
npm ERR! cb() never called!
npm ERR! not ok code 0

Contributor

luk- commented Sep 22, 2013

Does this happen on latest? If it does, good idea.

yes - happened on npm 1.3 as well for me.

Member

robertkowalski commented Sep 24, 2013

hrm not able to reproduce this, i get this (user foo-private on package foo-private):

(19:21:00) [robert@tequila-osx] ~/foo-private (master) $ npm publish
npm http PUT https://registry.npmjs.org/foo-private
npm http 409 https://registry.npmjs.org/foo-private
npm http GET https://registry.npmjs.org/foo-private
npm http 200 https://registry.npmjs.org/foo-private
npm http PUT https://registry.npmjs.org/foo-private/-/foo-private-0.4.1.tgz/-rev/20-0edaf0d6eb0c81f0e6d9e7b796ad853c
npm http 403 https://registry.npmjs.org/foo-private/-/foo-private-0.4.1.tgz/-rev/20-0edaf0d6eb0c81f0e6d9e7b796ad853c
npm http PUT https://registry.npmjs.org/foo-private/-/foo-private-0.4.1.tgz/-rev/20-0edaf0d6eb0c81f0e6d9e7b796ad853c
npm http 403 https://registry.npmjs.org/foo-private/-/foo-private-0.4.1.tgz/-rev/20-0edaf0d6eb0c81f0e6d9e7b796ad853c
npm ERR! publish Error uploading package
npm ERR! Error: forbidden user: foo-private not authorized to modify foo-private
npm ERR! Added: _attachments.foo-private-0.4.1.tgz: foo-private/-/foo-private-0.4.1.tgz/-rev/20-0edaf0d6eb0c81f0e6d9e7b796ad853c
npm ERR!     at RegClient.<anonymous> (/Users/robert/npm/node_modules/npm-registry-client/lib/request.js:272:14)
npm ERR!     at Request.self.callback (/Users/robert/npm/node_modules/request/request.js:129:22)
npm ERR!     at Request.EventEmitter.emit (events.js:98:17)
npm ERR!     at Request.<anonymous> (/Users/robert/npm/node_modules/request/request.js:873:14)
npm ERR!     at Request.EventEmitter.emit (events.js:117:20)
npm ERR!     at IncomingMessage.<anonymous> (/Users/robert/npm/node_modules/request/request.js:824: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 log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/Users/robert/.nvm/v0.10.18/bin/npm" "publish"
npm ERR! cwd /Users/robert/foo-private
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.11
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/robert/foo-private/npm-debug.log
npm ERR! not ok code 0

i had the same error running v0.10.19... i rolled back to v0.10.10 and it worked.

I'm having the issue though with installing dependencies. Should this be a separate Issue?

Ubuntu Server 12.04 LTS
Node: v0.10.19
NPM: 1.3.11

It happens every time.

Same i created a separate issue but it still persists on a clean image.

I noticed that if I roll back to Node .10.18 and NPM 1.3.8 the issue goes away. It must be a recent bug.

Member

domenic commented Sep 26, 2013

It seems like the upgrade to Node 0.10.19 is what's triggering this... any counterexamples?

Mac OS X 10.8.5 with Node v0.10.19 and NPM 1.3.11 seems fine.

Member

robertkowalski commented Oct 29, 2013

"npm ERR! cb() never called!" was fixed with Node v0.10.20 (Stable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment