Firebase and AngularDart. Error: There was an issue preparing Hosting files for upload

Issue

I’m trying to host my web app in Firebase. I runned:

  1. webdev build --output build,
  2. firebase init, and
  3. firebase deploy,

but I received a error message:

Error: There was an issue preparing Hosting files for upload.

So I runned firebase deploy --debug. The error message was:

i  hosting: preparing build/web directory for upload...
[2018-08-11T14:30:25.054Z] Error: ELOOP: too many symbolic links encountered, stat 'C:\Users\marco\MyWebApp\WEB\WEBSITE
- Copia\build\web\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages\packages'

Error: There was an issue preparing Hosting files for upload.

How can I resolve this error?

(If I run firebase serve, it works).

Thank you very much!

Solution

As mentioned in this answer, ensure that in the firebase.json file you’ve set the hosting.public field to "build/web":

{
  "hosting": { "public": "build/web" }
}

There seems to be an issue with webdev builds at the moment (unless it is a firebase issue). Anyhow, as a workaround, I found that deleting the symlink that causes the loop (build/packages/packages) solved the issue for me.

From the root of your project run this command every time you rerun webdev build -o build:

  rm build/packages/packages

After that both firebase serve and firebase deploy worked for me.

Answered By – Patrice Chalin

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *