Error reports and solutions when NPM publish publishes an angular Library

Time:2021-11-24

Today, I intend to publish my own NPM library to the public network according to the NPM file:

Error reports and solutions when NPM publish publishes an angular Library

After NPM login, use the named line NPM config set registry=http://registry.npmjs.org, the following error was encountered:

npm notice Beginning October 4, 2021, all connections to the npm registry – including for package installation – must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-2…
npm ERR! code E426
npm ERR! 426 Upgrade Required – PUT http://registry.npmjs.org/my-lib

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\I042416\AppData\Roaming\npm-cache\_logs\2021-10-17T02_40_15_408Z-debug.log

The main idea is that from October 4, 2021, all connections to NPM registry need to use TLS 1.2

Therefore, I changed the naming line to HTTPS, and the old error message disappeared:

npm config set registry=http://registry.npmjs.org

However, I encountered a new error message: you do not have permission to publish “my lib”. Are you logged in as the correct user?

Error reports and solutions when NPM publish publishes an angular Library

npm ERR! code E403
npm ERR! 403 403 Forbidden – PUT https://registry.npmjs.org/my… – You do not have permission to publish “my-lib”. Are you logged in as the correct user?
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\I042416\AppData\Roaming\npm-cache\_logs\2021-10-17T02_44_36_666Z-debug.log

The reason for this error is that the library name I used in package.json is called my lib, which I copied from the NPM tutorial. Someone has uploaded a library with the same name to the NPM warehouse, so I don’t have permission to upload a library with the same name.
Error reports and solutions when NPM publish publishes an angular Library

Modify the name field in package.json:

Error reports and solutions when NPM publish publishes an angular Library

After that, the library can be uploaded successfully:

Error reports and solutions when NPM publish publishes an angular Library

Error reports and solutions when NPM publish publishes an angular Library

More Jerry’s original articles are: “Wang Zixi”:
Error reports and solutions when NPM publish publishes an angular Library

Recommended Today

Seven solutions for distributed transactions

1、 What is distributed transaction Distributed transaction means that transaction participants, transaction supporting servers, resource servers and transaction managers are located on different nodes of different distributed systems. A large operation is completed by more than n small operations. These small operations are distributed on different services. For these operations, either all of them are […]