上面的代码是用 intellij IDEA 编写的,试图实现 Google Prediction API。
var prediction= require('../googleapis/apis/prediction/v1.6');
var params = {
project: "693608054772",
resource: {"id": "predictiondemo-1054", "storageDataLocation": "prediction3/language_id.txt"}
};
prediction.trainedmodels.insert(params, function (response) {
if (err) {
console.log("response occured:", response);
}
});
出现的错误如下:
/usr/local/bin/node predictionbhola.js
/home/bhola/projects/nodejs/applane/node_modules/MyTests/predictionbhola.js:8
prediction.trainedmodels.insert(params, function (response) {
^
TypeError: Cannot read property 'insert' of undefined
at Object.<anonymous> (/home/bhola/projects/nodejs/applane/node_modules/MyTests/predictionbhola.js:8:25)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
过程以退出代码 1 结束。