NPM package release troubleshooting records

HTTPS to upgrade

This article was written on 2021, 10/14. NPM has issued a notice in April to discard HTTP plain text links and use HTTPS links. If not upgraded, E426 error will be displayed.

NPM install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgzCopy the code

If you see

Hello! The tls-test package was successfully downloaded and installed. Congratulations! Your package manager appears to support TLS 1.2.

If the installation fails, NPM is advised to upgrade to V7 and check the Node version

Registration Source correlation

When publishing NPM packages, switch the registration source to NPM’s original HTTPS URL! Notice, HTTPS url!

npm config set registry=https://registry.npmjs.org
Copy the code

Without permission, 403

npm ERR! publish Failed PUT 403
npm ERR! code E403
Copy the code
  • The name is repeated. Check the official website of NPM
  • Package names with @, for example@vue/cliHere, take@vueFor example,@vueIt actually stands for onenpm-organizationThe name forvueThe organization, so if your bag name is@husky/cli, you need to create a new onehuskytheorganizationAfter creating, remember to execute locallynpm loginLog in again so you can publish successfully

private

npm ERR! publish Failed PUT 402
npm ERR! code E402
npm ERR! You must sign up for private packages :
Copy the code

If the package name starts with @your-name, NPM publish will publish as a private package by default. However, NPM private packages need to be paid, so you need to add the following parameters to publish:

npm publish --access public 
Copy the code