I am trying to use angular httpClient to access npm registry to get specific package dependencies
When I am doing the request I am getting CORS error
Access to XMLHttpRequest at 'https://registry.npmjs.org/async/2.0.1' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. http://registry.npmjs.org/async/2.0.1
this.httpClient.get(requestUrl).pipe(catchError(this.handleError)).subscribe((result: any) => {
console.log(result);
});`
Do I need to add headers to request in order of this to work?
You can use unpkg (https://unpkg.com/) instead of https://npmjs.com/
Unpkg is a CDN and allows to use fetch
and XMLHttpRequest