How to migrate NPM package to an organization @scope

You can change your package.json from:

"name": "project-name"

to:

"name": "@scope/project-name"

and publish the package:

npm publish --access=public

Update: The --access=public argument is needed to make the scoped package public – otherwise it will be private by default. Instead of the command-line argument you can set access to "public" in the publishConfig section of your package.json:

"publishConfig": {
  "access": "public"
}

(Thanks to Danilo Bargen and Greg Pratt for pointing it out in the comments!)

See: https://docs.npmjs.com/getting-started/scoped-packages

The npm doesn’t support redirects from old names to new names but
you can deprecate the old package with:

npm deprecate <pkg>[@<version>] <message>

So that people who install the old version would be notified that they should install another package instead.

See: https://docs.npmjs.com/cli/deprecate

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)