Firebase - Issue during deployment getting error : Error: An unexpected error has occurred

Firebase - Issue during deployment getting error : Error: An unexpected error has occurred

当我在本地主机中使用以下命令测试我的应用程序时,它工作正常。

firebase serve --only functions,hosting

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

firebase deploy

firebase deploy --only functions,hosting

最初的错误是更新 firebase-functions 和 firebase-admin,所以我在阅读下面的指南后继续更新它 link。我没有使用任何这些功能。 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/**"
    ]
  }
}

请告诉我如何继续,因为没有错误消息的原因。我真的卡住了。

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