1 进入项目根目录下的client目录 npm init
2 npm install node-fetch
3 在开发工具中 -> 构建npm
4 pages/index/index.js 中引入 const fetch = require(‘node-fetch’)
出现以下错误
VM608:1 thirdScriptError
sdk uncaught third Error
module “miniprogram_npm/node-fetch/stream” is not defined
Error: module “miniprogram_npm/node-fetch/stream” is not defined
at require (http://127.0.0.1:52229/appservice/__dev__/WAService.js:23:11483)
at http://127.0.0.1:52229/appservice/__dev__/WAService.js:23:11231
at __REQUIRE__ (http://127.0.0.1:52229/appservice/miniprogram_npm/node-fetch/index.js:17:32)
at http://127.0.0.1:52229/appservice/miniprogram_npm/node-fetch/index.js:1805:23
at Object.module.exports.map [as func] (http://127.0.0.1:52229/appservice/miniprogram_npm/node-fetch/index.js:50:16)
at __REQUIRE__ (http://127.0.0.1:52229/appservice/miniprogram_npm/node-fetch/index.js:18:71)
at http://127.0.0.1:52229/appservice/miniprogram_npm/node-fetch/index.js:1807:9
at http://127.0.0.1:52229/appservice/miniprogram_npm/node-fetch/index.js:1808:2
at require (http://127.0.0.1:52229/appservice/__dev__/WAService.js:23:11624)
at http://127.0.0.1:52229/appservice/__dev__/WAService.js:23:11231