ReferenceError: fetch is not defined

前端 未结 10 1855
闹比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:16

    If it has to be accessible with a global scope

    global.fetch = require("node-fetch");
    

    This is a quick dirty fix, please try to eliminate this usage in production code.

提交回复
热议问题