ReferenceError: fetch is not defined

前端 未结 10 1845
闹比i
闹比i 2020-11-29 17:48

I have this error when I compile my code in node.js, how can I fix it?

RefernceError: fetch is not defined

This is the function I am doing, it is re

10条回答
  •  北海茫月
    2020-11-29 18:30

    You should add this import in your file:

    import * as fetch from 'node-fetch';
    

    And then, run this code to add the node-fetch:

    yarn add node-fetch
    

提交回复
热议问题