أحاول استخدام 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 }
أي مساعدة مقدرة
أهلا بك! سامحني ، لكنني لست مألوفًا بشكل رهيب مع النيزك. هل تجري نوعا من تحول بابل؟ لقد لاحظت أنك تستخدم صيغة الوحدة النمطية import
es لطلب الوحدات النمطية ، ولكن يجب نقلها.
نقطة الله ، لم أفكر في ذلك ،
يستخدم
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
تمت ترقية برنامج Babel-runtime من 1.2.5 إلى 1.2.7
وهي تعمل الآن
التعليق الأكثر فائدة
تمت ترقية برنامج Babel-runtime من 1.2.5 إلى 1.2.7
وهي تعمل الآن