/root/ocr/node_modules/baidu-aip-sdk/src/AipImageSearch.js:18
const BaseClient = require('./client/baseClient');
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/root/ocr/node_modules/baidu-aip-sdk/src/index.js:20:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
[root@localhost src]# node -v
v0.10.46
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
完全没看到任何错误信息啊
是你的node.js版本太老了
0.10应该是14年的时候的老物件了吧。一是太老,二他不是LTS,不建议在线上使用。
报错的原因是您的node.js不支持es2016的语法,原因是版本太老了
建议升级至node.js 8, 他是官方提供的LTS版本,升级后SDK可正常使用
失败的内容能发出来吗?
百度AI不管是API还是SDK使用。接口都会返回json格式的字符串。
如果是SDK本身就有问题。那也建议你描述清楚。例如你使用的node版本环境。sdk版本等等。
http://ai.baidu.com/docs#/OCR-Node-SDK/top 有对node版本要求说明哦
SDK是开源的。https://github.com/Baidu-AIP/nodejs-sdk
早些版本我也测试过。并没有问题。当然我是完全不会nodejs。百度下载的webstrom开发工具。按文档要求安装相关。测试是没有问题。
您不妨说一下使用的SDK版本。错误信息。我下班回家也测试看看。
我连请求access_token都是失败的
http://ai.baidu.com/docs#/OCR-Node-SDK/top 有对node版本要求说明哦
百度AI不管是API还是SDK使用。接口都会返回json格式的字符串。
如果是SDK本身就有问题。那也建议你描述清楚。例如你使用的node版本环境。sdk版本等等。