简体   繁体   中英

Cannot invoke and expression error in Visual Studio Code

Getting VSCode error while calling request function of NodeJs Request package

I am unable to find why VSCode is complaining about this issue?

So for the same I have created a separate function for calling request() api , but still, the VSCode error persists.

在此处输入图片说明

EDIT 2: 在此处输入图片说明

Most likely its due to you importing 'request' module in a wrong way. The code below works as expected in node.js:

import * as request from 'request';

request(
{
    url: 'https://www.google.co.in',
    method: 'POST'
},
(res)=>
{


}); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM