how to fix this error TypeError [ERR_INVALID_CALLBACK]: Callback must be a function

前端 未结 6 1860
无人及你
无人及你 2021-01-03 18:10

I am a beginner to the nodejs. When I type the below, the code error occurs like this:

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function

6条回答
  •  旧时难觅i
    2021-01-03 18:37

    fs.writeFile(...) requires a third (or fourth) parameter which is a callback function to be invoked when the operation completes. You should either provide a callback function or use fs.writeFileSync(...)

    See node fs docs for more info.

提交回复
热议问题