-
Create an npm account (if you don't have one):
- Visit https://www.npmjs.com/signup
- Create your account with username, email, and password
-
Verify your email:
- Check your email for the verification link from npm
- Click the link to verify your account
Run the following command and enter your npm credentials:
npm loginYou'll be prompted for:
- Username
- Password
- One-time password (if 2FA is enabled)
npm whoamiThis should display your npm username.
- Ensure your package.json has all necessary fields
- Test your package one more time:
npm test - Check the files that will be included:
npm pack --dry-run
npm publishAfter publishing, your package will be available at: https://www.npmjs.com/package/agent-chat
You can also verify by running:
npm view agent-chatWhen you make changes and want to publish a new version:
-
Update the version in package.json:
- Patch release (bug fixes):
npm version patch - Minor release (new features):
npm version minor - Major release (breaking changes):
npm version major
- Patch release (bug fixes):
-
Publish the new version:
npm publish
npm profile enable-2fa auth-and-writesThis will require a one-time password from an authenticator app when publishing.
- E403 Forbidden: The package name might be taken or you don't have permission
- E401 Unauthorized: You need to login with
npm login - E402 Payment Required: Private packages require a paid npm account
- Always test before publishing
- Use semantic versioning
- Keep your README up to date
- Add a CHANGELOG.md for version history
- Consider adding a LICENSE file
- Use
npm publish --dry-runto preview what will be published