Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrinkpack fails to download from private registries that require authentication #50

Closed
marcins opened this issue Jun 27, 2016 · 2 comments

Comments

@marcins
Copy link

marcins commented Jun 27, 2016

Expected behaviour

Shrinkpack can download packages from a private registry, where the registry has already been authenticated against using npm login.

Actual behaviour

Downloads fail with a 401 (Unauthorized) error.

Steps to reproduce

  • Have a private NPM registry
  • Have a package from your private NPM registry in your package.json / npm-shrinkwrap.json
  • Run shrinkpack.

Software versions used

OS         : OS X 10.11.5
node.js    :  4.4.4
npm        :  3.10.2
shrinkpack : 0.12.5

Log output when running shrinkpack

i 1 dependencies in npm-shrinkwrap.json
i 0 need removing from ./node_shrinkwrap
i 1 need adding to ./node_shrinkwrap
i 0 are in your npm cache
i 1 need downloading
i 0 have a missing "resolved" property
↓ @atlassian/[email protected] from https://npm-private.atlassian.io/@atlassian%2ffunctional/-/@atlassian%2ffunctional-0.3.0.tgz
! failed to download @atlassian/[email protected]
! Please raise an issue at https://github.com/JamieMason/shrinkpack/issues

    Error: Command failed: /bin/sh -c npm cache add https://npm-private.atlassian.io/@atlassian%2ffunctional/-/@atlassian%2ffunctional-0.3.0.tgz
    npm ERR! fetch failed https://npm-private.atlassian.io/@atlassian%2ffunctional/-/@atlassian%2ffunctional-0.3.0.tgz
    npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 401
    npm ERR! fetch failed https://npm-private.atlassian.io/@atlassian%2ffunctional/-/@atlassian%2ffunctional-0.3.0.tgz
    npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 401
    npm ERR! fetch failed https://npm-private.atlassian.io/@atlassian%2ffunctional/-/@atlassian%2ffunctional-0.3.0.tgz
    npm ERR! Darwin 15.5.0
    npm ERR! argv "/Users/mszczepanski/.nvm/versions/node/v4.4.4/bin/node" "/Users/mszczepanski/.nvm/versions/node/v4.4.4/bin/npm" "cache" "add" "https://npm-private.atlassian.io/@atlassian%2ffunctional/-/@atlassian%2ffunctional-0.3.0.tgz"
    npm ERR! node v4.4.4
    npm ERR! npm  v3.10.2

    npm ERR! fetch failed with status code 401
    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!     /private/tmp/repro/npm-debug.log

        at ChildProcess.exithandler (child_process.js:213:12)
        at emitTwo (events.js:87:13)
        at ChildProcess.emit (events.js:172:7)
        at maybeClose (internal/child_process.js:827:16)
        at Socket.<anonymous> (internal/child_process.js:319:11)
        at emitOne (events.js:77:13)
        at Socket.emit (events.js:169:7)
        at Pipe._onclose (net.js:477:12)

Contents of your npm-shrinkwrap.json or package.json

{
  "name": "shrinkpack-private-test",
  "version": "1.0.0",
  "dependencies": {
    "@atlassian/functional": "^0.3.0"
  }
}
{
  "name": "shrinkpack-private-test",
  "version": "1.0.0",
  "dependencies": {
    "@atlassian/functional": {
      "version": "0.3.0",
      "from": "@atlassian/functional@latest",
      "resolved": "https://npm-private.atlassian.io/@atlassian%2ffunctional/-/@atlassian%2ffunctional-0.3.0.tgz"
    }
  }
}
@JamieMason
Copy link
Owner

Thanks a lot for this @marcins, I think this should be fixed soon by @5id's PR #47 👍

@marcins
Copy link
Author

marcins commented Jun 27, 2016

Awesome, yeah - that looks like it'll do the trick. I checked for open issues but didn't think to check for open PRs, thanks!

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

No branches or pull requests

2 participants