I am trying to deploy my node.js server to google cloud platform.
It works perfectly when I use it locally (run it with npm start
of node app.js
).
But when I try to deploy it (gcloud deploy
), it failed, and in the Log:
Error: Cannot find module 'firebase-admin' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/app/app.js:28:16) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3)
in app.js i use simply:
var firebase = require("firebase-admin");
and this is my package.json file:
{
"name": "Talk2Me-server",
"version": "1.0.3",
"main: "app.js",
"description": "Talk2Me app server",
"private": true,
"license": "Apache-2.0",
"scripts": {
"start": "node app.js"
},
"repository": {
"type": "git",
"url": "https://github.com/guytsur/Talk2Me.git"
},
"author": "Talk2Me Team,",
"contributors": [
"Guy Tsur<[email protected]>"
],
"cloud-repo-tools": {
"requiresKeyFile": true,
"requiresProjectId": true
},
"dependencies": {
"express": "~4.15.2",
"request": "^2.81.0",
"firebase-admin": "^4.1.2",
"firebase": "^2.4.2"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.16",
"ava": "~0.21.0",
"supertest": "~3.0.0",
"tap-dot": "~1.0.5"
},
"engines": {
"node": ">=4.3.2"
}
}
Thanks!