我有一个利用watson_developer_cloud的node.js应用程序。
当我在本地运行该应用程序时,它工作得很好,但是当我将它部署到BlueMix时,它会告诉我watson库中存在语法错误。最初它抱怨“在严格模式下非法使用const”,但后来我将启动命令改为"node --harmony app.js“。
现在的错误是:
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR /home/vcap/app/node_modules/watson-developer-cloud/language-translation/v2.js:109
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR for (const type in inputTypes) {
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR ^^
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR SyntaxError: Unexpected token in
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Module._compile (module.js:439:25)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Object.Module._extensions..js (module.js:474:10)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Module.load (module.js:356:32)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Function.Module._load (module.js:312:12)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Module.require (module.js:364:17)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at require (module.js:380:17)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/node_modules/watson-developer-cloud/index.js:37:33)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Module._compile (module.js:456:26)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Object.Module._extensions..js (module.js:474:10)
2017-08-15T11:36:31.73+0100 [APP/PROC/WEB/0] ERR at Module.load (module.js:356:32)关于如何解决这个问题有什么想法吗?(正如我所说的,它在本地运行良好)
发布于 2017-08-15 20:25:56
谢谢你告诉我。
我的package.json在engines部分指定了"0.10.x“的节点版本(这是我继承的旧示例)。当我将它编辑到6.11.1时,它开始工作得很好。
https://stackoverflow.com/questions/45691442
复制相似问题