Npm documentation says underscore as a leading character isn't allowed in package name, but it is allowed in the registry


(Rich Seddon) #1

What I Wanted to Do

I expect that the rules for npm package names would be enforced on the npm registry.

What Happened Instead

The npm package name documentation clearly states that package names starting with underscores are not allowed:

But a package with name starting with an underscore has been published:

Reproduction Steps

See above.


Either the documentation should be updated, or the registry should be changed to disallow packages that begin with characters that are not allowed.

(Lars Willighagen) #2

The scope counts as part of the name in this case. For unscoped packages, it is being checked (source).

(Peter Lynch) #3

Can the documentation clarify that the interaction of scope + name vs. name without leading scope?

Suggestion, change:

“The name can’t start with a dot or an underscore.”


“If the package name does not include a scope, the package name value can’t start with a dot or an underscore.”

The current wording does a poor job of distinguishing that scope is a part of the entire name.

(Lars Willighagen) #4