首页 文章

Firebase - 部署期间出现问题错误:错误:发生了意外错误

提问于
浏览
0

当我使用localhost中的以下命令测试我的应用程序时,它工作正常 .

firebase serve --only functions,hosting

但是当我尝试使用下面的命令部署它时 . 它失败并显示错误消息(错误:发生意外错误 . ) . 没有提供太多细节

firebase deploy

要么

firebase deploy --only functions,hosting

最初的错误是更新firebase-functions和firebase-admin所以我继续阅读下面链接中的指南后更新它 . 我没有使用任何这些功能 . https://firebase.google.com/docs/functions/beta-v1-diff#realtime-database

npm install firebase-functions@latest --save
npm install firebase-admin@5.11.0 --save
npm install -g firebase-tools

这是输出使用命令:firebase deploy --debug

[debug] [2018-05-14T18:59:35.734Z] ----------------------------------------------------------------------
[debug] [2018-05-14T18:59:35.739Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase deploy --only functions,hosting
[debug] [2018-05-14T18:59:35.740Z] CLI Version:   3.18.4
[debug] [2018-05-14T18:59:35.740Z] Platform:      win32
[debug] [2018-05-14T18:59:35.740Z] Node Version:  v8.10.0
[debug] [2018-05-14T18:59:35.741Z] Time:          Tue May 15 2018 00:29:35 GMT+0530 (India Standard Time)
[debug] [2018-05-14T18:59:35.741Z] ----------------------------------------------------------------------
[debug] 
[debug] [2018-05-14T18:59:35.759Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2018-05-14T18:59:35.762Z] > authorizing via signed-in user
[debug] [2018-05-14T18:59:35.765Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2018-05-14T18:59:35.766Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 { refresh_token: '1/V2t23LrBy9dznRfmTQnnh-0x3k3RrWFiA2EbNwRErOU',
  client_id: '563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com',
  client_secret: 'j9iVZfS8kkCEFUPaAeJV0sAi',
  grant_type: 'refresh_token',
  scope: 'email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid' } 
 Tue May 15 2018 00:29:35 GMT+0530 (India Standard Time)
[debug] [2018-05-14T18:59:36.385Z] <<< HTTP RESPONSE 200
[debug] [2018-05-14T18:59:36.393Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/stashit-7885bob  

 Tue May 15 2018 00:29:36 GMT+0530 (India Standard Time)
[debug] [2018-05-14T18:59:37.606Z] <<< HTTP RESPONSE 200
[debug] [2018-05-14T18:59:37.607Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/stashit-7885bob/tokens  

 Tue May 15 2018 00:29:37 GMT+0530 (India Standard Time)
[debug] [2018-05-14T18:59:38.662Z] <<< HTTP RESPONSE 200
[info] 
[info] === Deploying to 'stashit-7885bob'...
[info] 
[info] i  deploying functions, hosting
[debug] [2018-05-14T18:59:46.087Z] > [functions] package.json contents: {
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase serve --only functions",
    "shell": "firebase experimental:functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "body-parser": "^1.18.2",
    "cookie-parser": "^1.4.3",
    "cors": "^2.8.4",
    "ejs": "^2.5.9",
    "express": "^4.16.3",
    "firebase": "^5.0.2",
    "firebase-admin": "^5.11.0",
    "firebase-functions": "^1.0.2"
  },
  "private": true
}
[info] i  functions: ensuring necessary APIs are enabled...
[debug] [2018-05-14T18:59:46.087Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/stashit-7885bob?view=CONSUMER_VIEW  

 Tue May 15 2018 00:29:46 GMT+0530 (India Standard Time)
[debug] [2018-05-14T18:59:46.092Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/stashit-7885bob?view=CONSUMER_VIEW  

 Tue May 15 2018 00:29:46 GMT+0530 (India Standard Time)
[debug] [2018-05-14T18:59:48.558Z] <<< HTTP RESPONSE 200
[debug] [2018-05-14T18:59:48.586Z] <<< HTTP RESPONSE 200
[info] +  functions: all necessary APIs are enabled
[debug] [2018-05-14T18:59:48.588Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/stashit-7885bob  

 Tue May 15 2018 00:29:48 GMT+0530 (India Standard Time)
[debug] [2018-05-14T18:59:50.672Z] <<< HTTP RESPONSE 200
[debug] [2018-05-14T18:59:50.673Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/288692255744:getServerAppConfig  

 Tue May 15 2018 00:29:50 GMT+0530 (India Standard Time)
[debug] [2018-05-14T18:59:51.783Z] <<< HTTP RESPONSE 200
[debug] [2018-05-14T18:59:52.294Z] TypeError: Path must be a string. Received [ 'public/',
  'public/css',
  'public/js',
  'public/mdb-css',
  'public/mdb-js',
  'functions/js',
  'public/images' ]
    at assertPath (path.js:28:11)
    at Object.resolve (path.js:211:7)
    at module.exports (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\resolveProjectPath.js:7:15)
    at module.exports (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\hosting\prepare.js:31:39)
    at _chain (C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:26:38)
    at C:\Users\Sushanth\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:29:14
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
[error] 
[error] Error: An unexpected error has occurred.

我的firebase.json文件看起来像这样

{
  "hosting": {
    "public": ["public/", "public/css", "public/js", "public/mdb-css", "public/mdb-js", "functions/js", "public/images"],
    "rewrites":[
      {"source" : "/timestamp", "function" : "app"},
      {"source" : "/stashlogin", "function" : "app"},
      {"source" : "/stash", "function" : "app"},
      {"source" : "/get", "function" : "app"},
      {"source" : "/put", "function" : "app"},
      {"source" : "/categorycolor", "function" : "app"},
      {"source" : "/category", "function" : "app"},
      {"source" : "/category/**", "function" : "app"},
      {"source" : "/put/**", "function" : "app"},
      {"source" : "/delete/**", "function" : "app"},
      {"source" : "/profile", "function" : "app"},
      {"source" : "/feedback", "function" : "app"}
    ],
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

由于没有错误消息的原因,请告诉我如何继续 . 我其实被卡住了 .

1 回答

  • 0

    您的 public 目录必须是单个字符串,而不是数组 .

相关问题