#Build errors on Netlify: Could not resolve Astro component

1 messages · Page 1 of 1 (latest)

prisma island
#
  • Failed during stage 'building site': Build script returned non-zero exit code: 2
  • Could not resolve ../components/Footer.astro from src/pages/index.astro

The issue seems to appear only when I add components. I have a "Header" component that seems to build fine, but the Footer component is now causing an issue despite following the Astro component documentation.

Here is the repo: https://github.com/adamlevoy/pikavibe-astro

Super bummed that I can't seem to get a very simple Astro component to build and deploy 😦

GitHub

Contribute to adamlevoy/pikavibe-astro development by creating an account on GitHub.

#

Build errors on Netlify: Could not resolve Astro component

#

The components work fine in dev environment, the issue is when trying to deploy to Netlify

#

I also tried updating node.js, I am currently running v18.16.1

brave sand
#

@prisma island could you share your project file structure? Also, try starting the import path with /src/components/Footer.astro and see if that builds.

prisma island
prisma island
#

Fyi I tried clearing cache via npm and Netlify and still no luck, will not build, same errors

#

I also tried restarting my machine as a desperate last reort 😦

prisma island
#

Hi @brave sand any ideas? Sorry to be impatient but spent many hours over the weekend trying to resolve this with no luck and have my hands tied here on a project I need to move forward.

brave sand
#

Hi @prisma island can you try two more things:

  1. adding initial beginning slash to the import /src/components/Header.astro
  2. If that doesn't work try with a dot in front: ./src/components/Header.astro
prisma island
prisma island
# brave sand Hi <@976927872189071370> can you try two more things: 1. adding initial beginnin...

@brave sand Both of these failed to build. Here are the deploy logs:

10:15:06 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
10:14:51 AM: build-image version: 310cc3c813338a2ca47a215a1ab6889dc6ff6cb7 (focal)
10:14:51 AM: buildbot version: d59e91ad7b9655bc2253d9308f8d23584a0c6ed8
10:14:51 AM: Fetching cached dependencies
10:14:51 AM: Starting to download cache of 96.9MB
10:14:53 AM: Finished downloading cache in 1.457s
10:14:53 AM: Starting to extract cache
10:14:54 AM: Finished extracting cache in 803ms
10:14:54 AM: Finished fetching cache in 2.31s
10:14:54 AM: Starting to prepare the repo for build

brave sand
#

One more thing to try: can you add the baseUrl setting under compilerOptions to your tsconfig.json:

{
  "extends": "astro/tsconfigs/base",
  "compilerOptions": {
    "baseUrl": ".",
  }
}

See if that works.

prisma island
brave sand
#

@prisma island looking on your repo there is no Footer.astro file in /components although it is the Header.astro import that seems to be failing. Can you try adding the Footer.astro component?

Then if it is still failing, try removing the Header and Footer components and imports from index.astro just to see if that will build.

prisma island
prisma island
#

@brave sand I created a fresh project "astro-demo" and copied files over from the problem repo and this repo is now building. Could there be an issue with the repo name? I tried deploying the problem repo prior to updating node.js, so maybe that is causing some issue?

https://github.com/adamlevoy/astro-demo

GitHub

Contribute to adamlevoy/astro-demo development by creating an account on GitHub.

brave sand
#

Wow that is so odd. I don't think the name should have any effect since there are no special chars or anything like that.

Is this building with the Header and Footer components or without?

prisma island
brave sand
#

Honestly I've had weird things like this happen and just using a new repo fixes it. Since you are early in the project is that going to be a problem or can you now just work off the new repro? I wish I had more answers for you ¯_(ツ)_/¯