I am following this quickstart tutorial to eventually be able to download certain files from my application.
As I followed through with the tutorial I got the error Cannot read property 'OAuth2' of undefined
and it's coming from that line:
const fs = require('fs');
const readline = require('readline');
const google = require('googleapis');
const OAuth2Client = google.auth.OAuth2; << google.auth = undefined
const SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'];
const TOKEN_PATH = 'credentials.json';
// the rest of the code is exactly as it is in the tutorial
I already installed googleapis @ 27 and here's my package.json
{
"name": "temp-google-drive-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"googleapis": "^27.0.0"
}
}
I have already reported that to google but in the interest of hopefully getting this done today has anyone here faced a similar issue?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…