我正在Node.js应用中运行以下代码:
var GoogleCloudStorage = require('@google-cloud/storage');
var storage = GoogleCloudStorage({
projectId: 'PROJECT_ID',
keyFilename: 'keyfile.json'
});
显示此错误
GoogleCloudStorage is not a function
怎么了?
答案 0 :(得分:2)
将代码更改为:
const {Storage} = require('@google-cloud/storage');
const storage = new Storage({
projectId: 'PROJECT_ID',
keyFilename: 'keyfile.json'
});
我无法让nodejs编译器接受GoogleCloudStorage
。