“This is the 14th day of my participation in the August Change Text Challenge. For details, see: August Change Text Challenge juejin.cn/post/ 6987962113788493831”.

preface

“The colours of August are of gold, bright and precious; The colours of August are brewed with sunshine, fragrant and brilliant.”

In the future, may you adjust yourself to the best state, work hard slowly, and get better slowly

NPM should be familiar to all of us and is an essential part of our daily front-end development. NPM related things or quite a lot, we often used to some commands or must be skilled.

Environmental installation

When we install Node on the local computer, the NPM version is already installed.

  1. Direct use ofMacthehomebrew homebrew node
  2. Or go to node’s website and download it directly: node’s website

After the installation, you can run the corresponding command to view the version, node -v, NPM -v

configuration

NPM provides basic commands to view and modify configurations, via NPM config

NPM config ls -l Displays all configurations

NPM config list Displays the regist address

NPM config set

Sets the configuration item and its corresponding value

NPM config get [

] Obtains the value of a configuration item

NPM config delete

Deletes a configuration

The configuration file

There will be a local file containing the NPM configuration. NPMRC file.

You can view the configuration of cat.npmrc.

You can modify the configuration file if you want to modify the configuration item. You can use the command to modify

CD: Switch to the root directory vim. NPMRC: Open the.npmrc file for modificationCopy the code

Package and publish the corresponding NPM package

Version number generation

NPM version Version number, you can manually change the project version, after the change will be in the root directory of package.json “version”: “*******”. Or use NPM version patch to automatically generate the next version of the current version, for example: “1.0.1” => “1.0.2”

Package and release the project

NPM Publish packages the current code, generates an NPM package, and publishes it to the corresponding NPM repository

conclusion

These are the nPM-related configurations and commands that individuals often use in their work.

If this post helped you, feel free to like 👍 and follow ⭐️

If there are any mistakes in this article, please correct them in the comments section 🙏🙏.