question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: npm run build error

See original GitHub issue

Describe the Bug

I installed the adapter, added it to my svelte.config.js and initialized firebase with firebase init.

When I run npm run build I get the following error:

> Error: Required "hosting[].rewrites" field not found for matched hosting configuration. Specify your Cloud Function with rewrite rule matching "source":"**"
TypeError: Error: Required "hosting[].rewrites" field not found for matched hosting configuration. Specify your Cloud Function with rewrite rule matching "source":"**"
    at parseFirebaseConfiguration (file:///[project-path]/node_modules/svelte-adapter-firebase/src/utils.js:124:9)
    at adapt (file:///[project-path]/node_modules/svelte-adapter-firebase/src/index.js:26:35)
    at adapt (file:///[project-path]/alohi/node_modules/@sveltejs/kit/dist/chunks/index4.js:377:8)
    at file:///[project-path]/alohi/node_modules/@sveltejs/kit/dist/cli.js:878:11

Steps to Reproduce

  1. Install sveltekit
  2. Install adapter
  3. Create github project
  4. Initialize firebase
  5. run npm run build

Expected Behaviour

I expect the site to build.

svelte-adapter-firebase version

0.13.0

sveltejs/kit version

1.0.0-next.178

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:24 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
mortscodecommented, Oct 1, 2021

If I update the hosting object to include rewrites, do you have an example of what that function in <functionName> should look like in functions/index.js?

"hosting": {
        "public": "public",
        "rewrites": [
            {
                "source": "**",
                "function": "<functionName>"
            }
        ],
        "ignore": [
            "firebase.json",
            "**/.*",
            "**/node_modules/**"
        ]
    }
1reaction
mortscodecommented, Oct 1, 2021

I updated it to

"rewrites": [
            {
                "source": "**",
                "function": "ssrServer"
            }
        ],

and now I’m getting the function in the terminal

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm run build - fails to compile despite development version ...
I have a react app created with create-react-app , and npm run build is failing to compile a production build. It throws the...
Read more >
Execution of "npm run build" causes an error and can not be ...
I purchased Material Dashboard Pro React.(material-dashboard-pro-react@1.2.0) Execution of "npm run build" causes an error and can not be ...
Read more >
Common errors | npm Docs
Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later. · This can be caused...
Read more >
Error when running npm run build : r/react - Reddit
I have a react app done and am attempting to learn how to deploy it for the first time. I type npm run...
Read more >
How can i fix npm run build error more efficiently - Support
i ran into error TS2565: Property 'defaultProps' is used before being assigned while “npm run build” OS: WSL2 Ubuntu 18.04 LTS Redash: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found