1

我刚刚开始研究 node.js,但无法将 tensorlfow js 模型导入我的应用程序。我正在使用的代码是:

import * as cocoSsd from '@tensorflow-models/coco-ssd'
const model = cocoSsd.load();

运行上述代码后,我收到以下错误:

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)
4

1 回答 1

1

如何将 babel 安装为开发依赖项

https://medium.com/@onlykiosk/complete-babel-7-guide-for-beginners-in-2019-7dd78214c464

查看有关 babel 是什么以及它是如何工作的帖子

于 2019-06-27T14:15:55.357 回答