我尝试使用Firebase管理SDK,如在ionic2中解释here。但是当我打电话给client.Send(mail);
时,我收到了这个错误:
admin.initializeApp
我已经通过 import * as admin from "firebase-admin";
....
admin.initializeApp({
credential: admin.credential.cert({
projectId: "<PROJECT_ID>",
clientEmail: "foo@<PROJECT_ID>.iam.gserviceaccount.com",
privateKey: "-----BEGIN PRIVATE KEY-----\n<KEY>\n-----END PRIVATE KEY-----\n"
}),
databaseURL: "https://<DATABASE_NAME>.firebaseio.com"
});
Error: Cannot find module "dns"
at webpackMissingModule (http://localhost:8101/build/main.js:178777:75)
at Object.<anonymous> (http://localhost:8101/build/main.js:178777:156)
at Object.<anonymous> (http://localhost:8101/build/main.js:180128:30)
at __webpack_require__ (http://localhost:8101/build/main.js:20:30)
at Object.<anonymous> (http://localhost:8101/build/main.js:178726:18)
at __webpack_require__ (http://localhost:8101/build/main.js:20:30)
at Object.<anonymous> (http://localhost:8101/build/main.js:132218:15)
at Object.internals.rfc3986 (http://localhost:8101/build/main.js:132683:30)
at __webpack_require__ (http://localhost:8101/build/main.js:20:30)
at Object.<anonymous> (http://localhost:8101/build/main.js:42488:13)
安装了dns模块,但仍然出现此错误。我有什么想法可以解决这个问题吗?