J
J
Jirafek2021-12-01 22:38:51
JavaScript
Jirafek, 2021-12-01 22:38:51

How to import the fetch module?

Hello, I am using fetch to get data from api. But it needs to be imported. Downloaded. I tried to do it in different ways, both through import and through require, but everything gives an error. Here's what I have now, at the request of the console in the file node_modules/node-fetch/package.json removed the line "type": "module" .61a7cf41babca919165643.png61a7cf48746e9374226988.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Emil, 2021-12-03
@MrCheatEugene

There is no fetch in node.js. There is http.get and https.get. Although, I still recommend not to use them, but just install Express.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question