1. Establish a standard package project
Project description:
package.json can be generated using npm init command, fill in relevant information
2. Register a package warehouse account
Registration command: npm adduser (because the local cannot directly publish to the remote npm package warehouse, it is recommended to use Taobao's mirroring agent)
npm install -g cnpm --registry=https://registry.npm.taobao.org, then use cnpm adduser to register
3.npm publish
I reported the following error when using the npm publish command
After Baidu found the following solution https://blog.csdn.net/hahahhahahahha123456/article/details/82055227
To summarize: you must first register an account on the npm official website ( https://www.npmjs.com ), and the local npm uses this user to log in to the remote npm warehouse to upload the package
Execute the npm publish command to publish the package to the remote, and log in to the npm official website to view
Download the package just uploaded