Google-api-nodejs-client: حدثت مشكلة أثناء استخدام الاستيراد {google} من "googleapis" في تطبيق Meteor

تم إنشاؤها على ٤ سبتمبر ٢٠١٨  ·  3تعليقات  ·  مصدر: googleapis/google-api-nodejs-client

أحاول استخدام googleapis مع Meteor Framework ، فهو يعتمد على npm.
فعلت:

 meteor npm i googleapis --save
+ [email protected]
added 27 packages from 43 contributors in 8.55s

ثم على الخادم

import {google} from 'googleapis';
import fs from 'fs';
Meteor.methods({
getAnalyticsReports: function() {
 console.log("google",google);
 console.log("fs",fs);
});

وينتج عنه

I20180904-12:17:30.744(2)? google undefined
I20180904-12:17:30.748(2)? fs { constants: 
I20180904-12:17:30.749(2)?    { O_RDONLY: 0,
I20180904-12:17:30.749(2)?      O_WRONLY: 1,
[...]

أو مثال آخر

    getAnalyticsReports: function() {
        const analyticsreporting = google.analyticsreporting({
          version: 'v4',
          auth: google.auth.oAuth2Client
        });
    }

يعطي
Exception while invoking method 'getAnalyticsReports' TypeError: Cannot read property 'analyticsreporting' of undefined

لسوء الحظ ، تجد الوحدة النمطية بسبب عدم وجود خطأ مثل هذا
import {google} from 'googleapis2';

Unable to resolve some modules:

  "googleapis2" in [...]/server/main.js (os.linux.x86_64)

If you notice problems related to these missing modules, consider running:

  meteor npm install --save googleapis2  

و
import * as test from 'googleapis';

    getAnalyticsReports: function() {
        console.log(test);
    }

I20180904-12:27:31.624(2)? { default: {}, [Symbol(__esModule)]: true }

أي مساعدة مقدرة

question

التعليق الأكثر فائدة

تمت ترقية برنامج Babel-runtime من 1.2.5 إلى 1.2.7
وهي تعمل الآن

ال 3 كومينتر

أهلا بك! سامحني ، لكنني لست مألوفًا بشكل رهيب مع النيزك. هل تجري نوعا من تحول بابل؟ لقد لاحظت أنك تستخدم صيغة الوحدة النمطية import es لطلب الوحدات النمطية ، ولكن يجب نقلها.

تمت ترقية برنامج Babel-runtime من 1.2.5 إلى 1.2.7
وهي تعمل الآن

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات

القضايا ذات الصلة

dibeesh picture dibeesh  ·  4تعليقات

JustinBeckwith picture JustinBeckwith  ·  3تعليقات

ACMerriman picture ACMerriman  ·  3تعليقات

streamnsight picture streamnsight  ·  4تعليقات

rainabba picture rainabba  ·  4تعليقات