Node.js 在NodeJS模块中使用npm包

Node.js 在NodeJS模块中使用npm包,node.js,npm,Node.js,Npm,我试图在我的模块中使用googleapis npm软件包,但出现以下错误: var gmail = google.gmail('v1'); ^ TypeError: google.gmail is not a function at Object.watchInbox (/home/ubuntu/workspace/functions/google_cloud.js:19:24) at /home/ubuntu/workspace/

我试图在我的模块中使用googleapis npm软件包,但出现以下错误:

var gmail = google.gmail('v1');
                       ^

TypeError: google.gmail is not a function
    at Object.watchInbox (/home/ubuntu/workspace/functions/google_cloud.js:19:24)
    at /home/ubuntu/workspace/bootstrap.js:54:38
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:446:3)
以下是模块代码:

(google_cloud.js)

以下是父文件代码:

(index.js)

你知道我做错了什么吗?提前感谢。

我不得不使用:

const {google} = require('googleapis'); 

这个修好了

const{google}=require('googleapis');意志work@VictorOliveira谢谢,成功了。
var googleCloudModules = require("./functions/google_cloud.js");
..    
googleCloudModules.watchInbox(auth)
..
const {google} = require('googleapis');