npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

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

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.

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

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.