0

angular 12 add library is giving bellow error

Unable to fetch package information for 'library@latest': Cannot convert undefined or null to object

detail error message:

 ℹ Using package manager: npm
 ✖ Unable to find compatible package.  Using 'latest'.
 ✖ Unable to fetch package information for 'library@latest': Cannot convert undefined or null to object

steps to reproduce

ng new newProject
ng add library @namespace/libname
Aniruddha Das
  • 20,520
  • 23
  • 96
  • 132

1 Answers1

-1

The command is generate not add!

The mistake was I was doing add rather generate. To add an library in an existing project, you need to do generate rather add

correct syntax:

ng generate library @candypal/website

Aniruddha Das
  • 20,520
  • 23
  • 96
  • 132