I created a angular 9 project with Angular CLI 9.1.5.
I install with npm in this project the request-promise library.
I start with :
npm i request --save
npm i @type/request
npm i request-promise --save
npm i @type/request-promise
When i run this project, i have a lot of error but i found online a solution, in my package.json i add :
"browser": {
"crypto": false,
"http": false,
"https": false,
"net": false,
"path": false,
"stream": false,
"tls": false,
"os": false,
"zlib": false,
"fs": false
}
In my tsconfigconfig.app.json
I add :
"types" : ["node"]
In my service i use :
import * as rp from 'request-promise';
export class test{
rpget(){
rp.get('xxxxxxxxxx').then(function(response2){
// expect(response.statusCode).toBe('GET /200');
/* console.log("respnse " + response2);
}).catch(function(error) {
console.log(error);
});
}
}
When i run ng serve, compilation ending but in the browser console i have the following error :
undefined###undefined### The "request" library is not installed automatically anymore.undefined### But is a dependency of "request-promise".undefined### Please install it with:undefined### npm install request --saveundefined###undefined
But request is installed in this project.