简体   繁体   English

指定的“公共”目录 {path} 不存在

[英]Specified "public" directory {path} does not exist

I am trying to add Hosting to an existing firebase app that has Functions up and running.我正在尝试将托管添加到现有的 firebase 应用程序,该应用程序已启动并运行功能。 I intended to host a react app that consume my existing functions.我打算托管一个使用我现有功能的反应应用程序。 The public directory I chose for hosting is /{react-project-root-folder}/build.我选择用于托管的公共目录是 /{react-project-root-folder}/build。

I followed this answer to add hosting.我按照这个答案添加了托管。

When I am running firebase deploy , it gives the error当我运行firebase deploy时,它给出了错误

Error: Specified "public" directory "/view/build" does not exist, can't deploy hosting to site {app-name}

Even though the folder exists.即使该文件夹存在。

Can you help me spot what I did wrong?你能帮我找出我做错了什么吗? Should I choose another folder?我应该选择另一个文件夹吗?

My folder structure:我的文件夹结构:

Firebase Practice
|__ functions
|__ .firebase.json
|__ .firebaserc
|__ view
    |__ build
        |__ static/js
        |__ index.html
    |__ node_modules
    |__ public
    |__ src

Image of folder structure:文件夹结构图:

在此处输入图像描述

firebase.json: firebase.json:

{
  "functions": {
    "ignore": [
      "node_modules",
      ".git",
      "firebase-debug.log",
      "firebase-debug.*.log"
    ],
    "source": "functions"
  },
  "hosting": {
    "public": "/view/build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "/api/*",
        "function": "api"
      },
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

Turn out you do not need the first / on your public path.原来你不需要公共路径上的第一个/

Corrected firebase.json:更正了 firebase.json:

{
  "functions": {
    "ignore": [
      "node_modules",
      ".git",
      "firebase-debug.log",
      "firebase-debug.*.log"
    ],
    "source": "functions"
  },
  "hosting": {
    "public": "view/build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure:指定容器不存在,Dapr with ContainerApps - Azure: The specified container does not exist, Dapr with ContainerApps 指定位置不存在脚本 || 代码部署问题 - Script does not exist at specified location || CodeDeploy issue AWS SQS 问题。 此 wsdl 版本不存在指定的队列 - AWS SQS issue. The specified queue does not exist for this wsdl version Codepipeline script_start 失败脚本在指定位置不存在 - Codepipeline script_start failed Script does not exist at specified location Pyspark - 加载文件:路径不存在 - Pyspark - Load file: Path does not exist AWS::S3::NoSuchKey 指定的键不存在 - AWS::S3::NoSuchKey The specified key does not exist aws-sdk: NoSuchKey: 指定的密钥不存在? - aws-sdk: NoSuchKey: The specified key does not exist? Spring 云 - SQS - 此 wsdl 版本不存在指定队列 - Spring Cloud - SQS - The specified queue does not exist for this wsdl version Google Cloud angular 托管站点显示指定密钥不存在 - Google Cloud angular hosted site displays specified key does not exist AWS PowerShell 工具错误:指定的键不存在 - Error in AWS PowerShell tool: The specified key does not exist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM