ng-packagr Unable to publish the Angular package to npm OR how to Fix Angular Valunerablities

339 views Asked by At

I am facing this error while publish the package to the npm using the npm publish command:

error code E403 error 403 403 Forbidden - PUT https://registry.npmjs.org/dist - You do not have permission to publish "dist". Are you logged in as the correct user? error 403 In most cases, you or one of your dependencies are requesting error 403 a package version that is forbidden by your security policy. verbose exit [ 1, true ]

2

There are 2 answers

0
Muhammad Shoaib Karamat On

Step-1: Add "resolutions" this section in your package.json file with the with the recommended package version.

"resolutions": {
    "postcss": "8.2.10",
    "node-fetch": "2.6.1"
  }

Step-2: Run this command to remove the node_module

rm -r node_modules

Step-3: Update the package-lock.json file by running this command

npx npm-force-resolutions

Step-4: after this command run npm install commands to install all the required packages with updated versions.

npm install

After the completion of all these steps now you can create the package again and publish to the npm. It works for me and I hopefully It works for you as well.

0
Hailemariam Addisu On

You have to use unique package name. since this error is happened the package name you create is taken by others or something not allowed name.