[英]Unable to import @tensorflow-models in node.js
I have just started working on node.js and I am unable to import tensorlfow js models into my application.我刚刚开始研究 node.js,但无法将 tensorlfow js 模型导入到我的应用程序中。 The code I am using is:我正在使用的代码是:
import * as cocoSsd from '@tensorflow-models/coco-ssd'
const model = cocoSsd.load();
After running the above code I get the following error:运行上面的代码后,我收到以下错误:
import * as cocoSsd from '@tensorflow-models/coco-ssd'
^
SyntaxError: Unexpected token *
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
How about installing babel as a dev dependency如何将 babel 安装为开发依赖项
https://medium.com/@onlykiosk/complete-babel-7-guide-for-beginners-in-2019-7dd78214c464 https://medium.com/@onlykiosk/complete-babel-7-guide-for-beginners-in-2019-7dd78214c464
Check out that post on what babel is and how it works查看有关 babel 是什么及其工作原理的帖子
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.