在角度2中获得许多错误,用于部署谷歌云视觉ocr

时间:2018-01-08 06:42:33

标签: javascript node.js angular typescript google-cloud-platform

 import { Injectable } from '@angular/core';

@Injectable()
export class ManualService {

  constructor() {
    // Imports the Google Cloud client library.

    const Storage = require('@google-cloud/storage');
 // Instantiates a client. If you don't specify credentials when constructing
 // the client, the client library will look for credentials in the
 // environment.
 const storage = Storage();

 // Makes an authenticated API request.
 storage
   .getBuckets()
   .then((results) => {
     const buckets = results[0];

     console.log('Buckets:');
     buckets.forEach((bucket) => {
       console.log(bucket.name);
     });
   })
   .catch((err) => {
     console.error('ERROR:', err);
   });
   }


}

我正在我的angular2 webapp中部署Google云视觉Ocr。但是当我在我的webapp代码中添加此代码时,我收到了很多错误。请帮我解决这个问题。

当我运行此代码时,它会给我这个输出: error

1 个答案:

答案 0 :(得分:1)

这样做

  

npm install

  

sudo npm install