Open shifeiyang opened 1 year ago
在真机上是这样报错的,是不是这个env需要在哪里进行配置 this.fetch = env().platform.fetch;
"undefined is not an object (evaluating '(0,l.env)().platform.fetch')", line: 1183, column: 144156, sourceURL: "https://usr//pages/train/app-service.js", stack: "e@https://usr//pages/train/app-service.js:1183:144156↵k@https://usr//pages/train/app-service.js:1183:149510↵value@https://usr//pages/train/app-service.js:1183:458213↵@https://usr//pages/train/app-service.js:1183:458556↵@https://usr//app-service.js:3624:515624↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵f@[native code]↵f@https://usr//app-service.js:3624:515892↵@https://usr//app-service.js:3624:521489↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵_tmp400@https://usr//app-service.js:3624:521944↵@https://usr//app-service.js:3624:517507↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵@https://usr//app-service.js:3624:517574↵@https://usr//app-service.js:3624:536440↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵a@[native code]↵a@https://usr//app-service.js:3624:536773↵@https://usr//app-service.js:3624:537521↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵o@[native code]↵o@https://usr//app-service.js:3624:537580↵@https://usr//app-service.js:3624:537814↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵@https://usr//app-service.js:3624:537855↵j@https://lib/WASubContext.js:1:70746↵@https://usr//app-service.js:3624:537199↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵_tmp409@https://usr//app-service.js:3624:537919↵@https://usr//app-service.js:3624:515624↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵f@[native code]↵f@https://usr//app-service.js:3624:515892↵@https://usr//app-service.js:3624:521489↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵_tmp400@https://usr//app-service.js:3624:521944↵@https://usr//app-service.js:3624:517507↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵@https://usr//app-service.js:3624:517574↵@https://usr//app-service.js:3624:536440↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵a@[native code]↵a@https://usr//app-service.js:3624:536773↵@https://usr//app-service.js:3624:537521↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵o@[native code]↵o@https://usr//app-service.js:3624:537580↵@https://usr//app-service.js:3624:537814↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵@https://usr//app-service.js:3624:537855↵j@https://lib/WASubContext.js:1:70746↵@https://usr//app-service.js:3624:537199↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵_tmp409@https://usr//app-service.js:3624:537919↵@https://usr//pages/train/app-service.js:1183:20385↵@https://usr//pages/train/app-service.js:1183:6579↵@https://usr//pages/train/app-service.js:1183:5621↵j@https://lib/WASubContext.js:1:70746↵f@https://usr//pages/train/app-service.js:1183:5410↵@https://usr//pages/train/app-service.js:1183:4110↵@https://usr//pages/train/app-service.js:1183:6579↵@https://usr//pages/train/app-service.js:1183:5621↵j@https://lib/WASubContext.js:1:70746↵f@https://usr//pages/train/app-service.js:1183:5410↵@https://usr//app-service.js:3624:515624↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵f@[native code]↵f@https://usr//app-service.js:3624:515892↵@https://usr//app-service.js:3624:521489↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]↵_tmp400@https://usr//app-service.js:3624:521944↵@https://usr//app-service.js:3624:517507↵@[native code]↵h@https://lib/WAServiceMainContext.js:1:41703↵anonymous@[native code]"}
小程序里没有fetch这个方法,需要先引入,然后配置给tfjs,参考这里的代码:https://github.com/HunterXuan/wx-tfjs-demo/blob/master/miniprogram/app.ts#L32
mp.runtime.esm.js?66fd:5840 TypeError: Cannot read property 'fetch' of undefined at new HTTPRequest (http.ts?bd5e:64) at http (http.ts?bd5e:387) at Object.browserHTTPRequest (http.ts?bd5e:397) at GraphModel.findIOHandler (graph_model.ts?a927:111) at GraphModel._callee$ (graph_model.ts?a927:126) at tryCatch (regeneratorRuntime.js?7ec2:44) at Generator. (regeneratorRuntime.js?7ec2:125)
at Generator.next (regeneratorRuntime.js?7ec2:69)
at asyncGeneratorStep (asyncToGenerator.js?c973:3)
at _next (asyncToGenerator.js?c973:22)(env: macOS,mp,1.06.2304191; lib: 2.32.1)