w3resource

How to change profile settings


in the previous tutorial, we showed you how to work with security tokens. The tutorial that you are about to read, will cover setting up your profile from the web and making changes to your profile.

Setting up your profile from the web

for you to set up your profile on npmjs.com, you have to login.

Once you are logged in, you should select Profile Setting from the Avatar menu.

npm Setting up your profile from the web

The profile page will appear:

npm profile page

It from this page, that you will be able to:

  • Change your avatar (the icon that will represent you)
  • Add a GitHub user name
  • Add a Twitter user name
  • Change the email that will appear with packages
  • Change your password
  • Revoke or apply two-factor-authentication
  • View Packages

Resetting your password from the web

Whenever you reset your password from the website, it should:

  • be at least 8 characters
  • not contain any part of your username
  • not be a password that is a common password
  • not be in the "Have I Been Pwned" breach database

How to Change Profile Settings from the CLI?

This requires npm version 5.5.1 or greater.

If you want to view and set profile properties from the Command Line Interface (CLI), you should use these commands:

npm profile get
npm profile set <prop><value>

Viewing & Setting Profile Values

Whenever you want to see your current profile settings, type:

npm profile get

npm will display your profile settings in a table:

npm Viewing and Setting Profile Values

You can either set or modify the following profile properties from the command line:

  • email
  • password
  • two factor auth
  • fullname
  • homepage
  • freenode
  • twitter
  • github

How to Set a Password from the Command Line

If you want to set a password, you should type:

npm profile set password

npm will prompt you to enter your current password, once you successfully enter your current password, you will be able to set the new password.

When you reset your password from the CLI, it should:

  • be at least 8 characters
  • not contain any part of your username
  • not be a password that is a common password
  • not be in the "Have I Been Pwned" breach database

How to Set Other Profile Properties

If you want to set other values, you can append them to the end of the line as shown:

npm profile set fullname nori pat marsupial

npm will ask for your credentials, including a one-time-password if you enabled two-factor authentication. npm then confirms that the change has occurred:

Set fullname to nori pat marsupial

Enabling and Disabling Two-Factor Authentication

You should enable two-factor authentication if you would like to make it more difficult for attackers to gain access to your account and to your publishing rights.

You can enable and disable two-factor authentication either from the command line, or from the web, by using the steps described in our tutorial on working with two-factor authentication.

Previous: How to work with security tokens
Next: Understanding packages and modules and preventing permissions errors



Follow us on Facebook and Twitter for latest update.