user21392777
user21392777

Reputation:

Why does NPM throw HTTP Error 400 for Publishing a Package?

I'm attempting to publish an NPM package, called 2680. There isn't a package/user/org with this name currently, and the rest of my package.json seems valid. Here's all the details:

{
  "name": "2680",
  "version": "0.1.0",
  "description": "A simple & performant library for handling reactive state.",
  "main": "src/2680.js",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/aarvinr/2680.git"
  },
  "type": "module",
  "keywords": [
    "library",
    "reactive",
    "js",
    "state"
  ],
  "author": "aarvinr",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/aarvinr/2680/issues"
  },
  "homepage": "https://github.com/aarvinr/2680#readme"
}
{
  "name": "2680",
  "version": "0.1.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "2680",
      "version": "0.1.0",
      "license": "MIT"
    }
  }
}

I tried running npm publish --access public, but it simply returned a cryptic http error 400 Bad Request PUT, and nothing else.

Upvotes: 0

Views: 325

Answers (1)

user21392777
user21392777

Reputation:

After contacting npm support, it turns out you can't have a package with only numbers in its name - even though this is documented LITERALLY NOWHERE (npm, please do better).

So, the only way to resolve this is to add letters (in my case 2680 has been renamed to 2680.js).

Upvotes: 1

Related Questions