question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing HTTP_NPM_SCOPE header when publishing

See original GitHub issue

We are attempting to do a lerna publish to packagecloud.io. The packagecloud.io API is failing with a 422 indicating that the NPM_SCOPE parameter is not set properly. After speaking with one of their engineers, they are expecting that the HTTP_NPM_SCOPE parameter be set properly, and in fact it is not being passed.

Expected Behavior

We are expecting that lerna publish will publish to packagecloud.io.

Current Behavior

We are told that the HTTP_NPM_SCOPE parameter is not being set by lerna, when the publish is being called.

Possible Solution

Can we add that as part of the publish?

Steps to Reproduce (for bugs)

  1. Have a packagecloud account.
  2. nvm install (lts/dubnium) (this is node 10.15.3 and npm 6.4.1)
  3. run npm publish ( It will publish)
  4. run lerna publish (it will fail with a 422 indicating that the npm-scope variable is missing.)
lerna.json

<!-- Please paste your `lerna.json` here -->
{
  "packages": [
    "dev/*"
  ],
  "npmClient": "npm",
  "command": {
    "publish": {
      "yes": true,
      "ignoreChanges": [
        "*.md",
        "*.spec.js"
      ]
    }
  },
  "useWorkspaces": true,
  "version": "independent"
}

lerna-debug.log

<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->

Context

We want to use lerna to publish and maintain a monorepo. We can’t publish. Everything else works great, lerna version, lerna bootstrap, lerna list - but the publish doesn’t work.

Your Environment

Executable Version
lerna --version 3.13.1
npm --version 6.4.1
yarn --version 1.12.3
node --version 10.15.3
OS Version
ubuntu 14.04

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
armandocanalscommented, Mar 9, 2019

Hi! Armando from packagecloud checking in.

After digging into this issue, it looks like what’s happening is that Lerna is passing the full @scope/package-name instead of just @scope to libnpmpublish which sets it as the HTTP_NPM_SCOPE header.

https://github.com/lerna/lerna/blob/a7ad9b60d27b390fde21fd2837f2d97320c4603e/utils/npm-publish/npm-publish.js#L34

The official registry supports both @scope and @scope/packagename for HTTP_NPM_SCOPE, but packagecloud does not.

From what I understand, this header is supposed to include just the @scope for a package.

I’m inclined to say that Lerna should only pass the @scope to libnpmpublish instead of the entire @scope/packagename, but I’m not familiar with the needs of the project, so I could be wrong.

We’re also discussing how to handle this better at packagecloud.

0reactions
evocateurcommented, Mar 9, 2019

The docs for project-scope are kinda vague on exactly what they should be used for. I’m cool with passing spec.scope (from npm-package-arg) there, instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems publishing scoped module · Issue #12194 - GitHub
Hello, I'm having problems publishing the scoped package @parametric-svg/spec (and ... 404 tarball, folder, http url, or git url. npm ERR!
Read more >
Error publishing a new version of a package in npm
These are simple way to install package : Publish your package to npm Make a new directory outside of your project and cd...
Read more >
npm-publish - npm Docs
Description. Publishes a package to the registry so that it can be installed by name. By default npm will publish to the public...
Read more >
How to troubleshoot NPM problems - JFrog
How to troubleshoot NPM problems · Using curl · NPM Login · NPM Install (Non-scoped) · NPM install (Scoped Packages) · NPM Publish...
Read more >
Ubuntu Manpage: npm-registry - The JavaScript Package ...
Yes. When making requests of the registry npm adds two headers with information about your environment: · Npm-Scope – If your project is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found