第一次在这里部署 GAE 应用程序,我正在尝试遵循本教程:https ://firebase.googleblog.com/2016/08/sending-notifications-between-android.html (请参阅节点代码部分)。
我跑了
npm install firebase-admin --save
npm install request --save
在我的机器上, package.json 在这里,但是当我使用gcloud app deploy
时,在浏览器上打开应用程序时会得到这些日志:
2017-02-10 09:35:02 default[20170210t103151] module.js:471
2017-02-10 09:35:02 default[20170210t103151] throw err;
2017-02-10 09:35:02 default[20170210t103151] ^
2017-02-10 09:35:02 default[20170210t103151]
2017-02-10 09:35:02 default[20170210t103151] Error: Cannot find module 'firebase-admin'
2017-02-10 09:35:02 default[20170210t103151] at Function.Module._resolveFilename (module.js:469:15)
2017-02-10 09:35:02 default[20170210t103151] at Function.Module._load (module.js:417:25)
2017-02-10 09:35:02 default[20170210t103151] at Module.require (module.js:497:17)
2017-02-10 09:35:02 default[20170210t103151] at require (internal/module.js:20:19)
2017-02-10 09:35:02 default[20170210t103151] at Object.<anonymous> (/app/server.js:1:78)
2017-02-10 09:35:02 default[20170210t103151] at Module._compile (module.js:570:32)
2017-02-10 09:35:02 default[20170210t103151] at Object.Module._extensions..js (module.js:579:10)
2017-02-10 09:35:02 default[20170210t103151] at Module.load (module.js:487:32)
2017-02-10 09:35:02 default[20170210t103151] at tryModuleLoad (module.js:446:12)
2017-02-10 09:35:02 default[20170210t103151] at Function.Module._load (module.js:438:3)
2017-02-10 09:35:07 default[20170210t103151] module.js:471
2017-02-10 09:35:07 default[20170210t103151] throw err;
2017-02-10 09:35:07 default[20170210t103151] ^
2017-02-10 09:35:07 default[20170210t103151]
2017-02-10 09:35:07 default[20170210t103151] Error: Cannot find module 'firebase-admin'
2017-02-10 09:35:07 default[20170210t103151] at Function.Module._resolveFilename (module.js:469:15)
2017-02-10 09:35:07 default[20170210t103151] at Function.Module._load (module.js:417:25)
2017-02-10 09:35:07 default[20170210t103151] at Module.require (module.js:497:17)
2017-02-10 09:35:07 default[20170210t103151] at require (internal/module.js:20:19)
2017-02-10 09:35:07 default[20170210t103151] at Object.<anonymous> (/app/server.js:1:78)
2017-02-10 09:35:07 default[20170210t103151] at Module._compile (module.js:570:32)
2017-02-10 09:35:07 default[20170210t103151] at Object.Module._extensions..js (module.js:579:10)
2017-02-10 09:35:07 default[20170210t103151] at Module.load (module.js:487:32)
2017-02-10 09:35:07 default[20170210t103151] at tryModuleLoad (module.js:446:12)
2017-02-10 09:35:07 default[20170210t103151] at Function.Module._load (module.js:438:3)
2017-02-10 09:43:58 default[20170210t104151] module.js:471
2017-02-10 09:43:58 default[20170210t104151] throw err;
2017-02-10 09:43:58 default[20170210t104151] ^
2017-02-10 09:43:58 default[20170210t104151]
2017-02-10 09:43:58 default[20170210t104151] Error: Cannot find module 'serviceAccountKey.json'
2017-02-10 09:43:58 default[20170210t104151] at Function.Module._resolveFilename (module.js:469:15)
2017-02-10 09:43:58 default[20170210t104151] at Function.Module._load (module.js:417:25)
2017-02-10 09:43:58 default[20170210t104151] at Module.require (module.js:497:17)
2017-02-10 09:43:58 default[20170210t104151] at require (internal/module.js:20:19)
2017-02-10 09:43:58 default[20170210t104151] at Object.<anonymous> (/app/server.js:7:22)
2017-02-10 09:43:58 default[20170210t104151] at Module._compile (module.js:570:32)
2017-02-10 09:43:58 default[20170210t104151] at Object.Module._extensions..js (module.js:579:10)
2017-02-10 09:43:58 default[20170210t104151] at Module.load (module.js:487:32)
2017-02-10 09:43:58 default[20170210t104151] at tryModuleLoad (module.js:446:12)
2017-02-10 09:43:58 default[20170210t104151] at Function.Module._load (module.js:438:3)
2017-02-10 09:44:10 default[20170210t104151] module.js:471
2017-02-10 09:44:10 default[20170210t104151] throw err;
2017-02-10 09:44:10 default[20170210t104151] ^
2017-02-10 09:44:10 default[20170210t104151]
2017-02-10 09:44:10 default[20170210t104151] Error: Cannot find module 'serviceAccountKey.json'
2017-02-10 09:44:10 default[20170210t104151] at Function.Module._resolveFilename (module.js:469:15)
2017-02-10 09:44:10 default[20170210t104151] at Function.Module._load (module.js:417:25)
2017-02-10 09:44:10 default[20170210t104151] at Module.require (module.js:497:17)
2017-02-10 09:44:10 default[20170210t104151] at require (internal/module.js:20:19)
2017-02-10 09:44:10 default[20170210t104151] at Object.<anonymous> (/app/server.js:7:22)
2017-02-10 09:44:10 default[20170210t104151] at Module._compile (module.js:570:32)
2017-02-10 09:44:10 default[20170210t104151] at Object.Module._extensions..js (module.js:579:10)
2017-02-10 09:44:10 default[20170210t104151] at Module.load (module.js:487:32)
2017-02-10 09:44:10 default[20170210t104151] at tryModuleLoad (module.js:446:12)
2017-02-10 09:44:10 default[20170210t104151] at Function.Module._load (module.js:438:3)
2017-02-10 16:20:02 default[20170210t124920] Error: Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2 access token with the following error: "connect ETIMEDOUT 74.125.202.84:443".
2017-02-10 16:20:02 default[20170210t124920] at /app/node_modules/firebase-admin/lib/firebase-app.js:74:23
2017-02-10 16:20:02 default[20170210t124920] at process._tickCallback (internal/process/next_tick.js:103:7)
我该如何解决 ??