rss-parser icon indicating copy to clipboard operation
rss-parser copied to clipboard

Error: Cannot find module 'https', 2 import { RequestOptions } from 'https'; with Angular 11

Open janlycka opened this issue 4 years ago • 4 comments

Hi, I get an error trying to use this module with Angular 11. Possibly due to deprecation as RequestOptions have long since been replaced with HttpClient

$ ng serve
- Generating browser application bundles...
√ Browser application bundle generation complete.

Initial Chunk Files   | Names         |    Size
main.js               | main          | 0 bytes
polyfills.js          | polyfills     | 0 bytes
runtime.js            | runtime       | 0 bytes
styles.css, styles.js | styles        | 0 bytes
vendor.js             | vendor        | 0 bytes

| Initial Total | 0 bytes

Build at: 2021-03-16T01:31:32.271Z - Hash: 2...4 - Time: 22616ms

Warning: C:\Users\...\blog.component.ts depends on 'rss-parser'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Error: node_modules/rss-parser/index.d.ts:2:32 - error TS2307: Cannot find module 'https' or its corresponding type declarations.

2 import { RequestOptions } from 'https';

I'm running Angular 11

$ ng version

...

Angular CLI: 11.2.3
Node: 12.16.2
OS: win32 x64

Angular: 11.2.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.3
@angular-devkit/build-angular   0.1102.3
@angular-devkit/core            11.2.3
@angular-devkit/schematics      11.2.3
@angular/cdk                    11.2.4
@angular/cli                    11.2.3
@angular/material               11.2.4
@schematics/angular             11.2.3
@schematics/update              0.1102.3
rxjs                            6.6.6
typescript                      4.1.5

I tried replacing RequestOptions with HttpClient but it seems that then I'd have to rewrite the whole module. Perhaps I'm missing something since nobody else on here seems to complain and there are thousands of users. Could you have a look?

Cheers & KR

janlycka avatar Mar 16 '21 11:03 janlycka

Yeah, I'm having the same issue

gudipudiramanakumar avatar Apr 23 '21 20:04 gudipudiramanakumar

In your package.json you have to add:

"browser": {
    "http": false,
    "https": false
}

But now, i've this problem: ERROR Error: Uncaught (in promise): TypeError: get is not a function

If somebody know how can i solve that...

yatobjection avatar Apr 25 '21 19:04 yatobjection

Were you able to find a solution for this?

JoshFoshT avatar Aug 08 '21 22:08 JoshFoshT

Same problem

FrancescoPaiola avatar Mar 01 '22 09:03 FrancescoPaiola