google云平台:"Can't find module firebase-admin"
google cloud platform: "Can't find module firebase-admin"
我正在尝试将我的 node.js 服务器部署到 google 云平台。
当我在本地使用它时它工作得很好(运行 它与 node app.js
的 npm start
)。
但是当我尝试部署它时 (gcloud deploy
),它失败了,并且在日志中:
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)
在app.js我简单地使用:
var firebase = require("firebase-admin");
这是我的 package.json 文件:
{
"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<guytsur7@google.com>"
],
"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"
}
}
谢谢!
好的,我设法解决了,
首先我使用
重新安装了软件包
npm install --save firebase-admin
而且我还做了一些修改,我添加到包文件中:
"scripts": {
"start": "npm install firebase-admin; node app.js"
},
我想这不是最好的做法,但它奏效了。
我正在尝试将我的 node.js 服务器部署到 google 云平台。
当我在本地使用它时它工作得很好(运行 它与 node app.js
的 npm start
)。
但是当我尝试部署它时 (gcloud deploy
),它失败了,并且在日志中:
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)
在app.js我简单地使用:
var firebase = require("firebase-admin");
这是我的 package.json 文件:
{
"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<guytsur7@google.com>"
],
"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"
}
}
谢谢!
好的,我设法解决了,
首先我使用
重新安装了软件包npm install --save firebase-admin
而且我还做了一些修改,我添加到包文件中:
"scripts": {
"start": "npm install firebase-admin; node app.js"
},
我想这不是最好的做法,但它奏效了。