astro-imagetools icon indicating copy to clipboard operation
astro-imagetools copied to clipboard

Unable to build astro app when using Picture component

Open ikovac opened this issue 2 years ago • 9 comments

I am getting the following error when I try to run npm run build command: Screenshot 2022-08-09 at 21 59 51

It works when I comment component import:

import { Picture } from "astro-imagetools/components"; 

Also, I am getting warning: Could not find a declaration file for module 'astro-imagetools/components'. './node_modules/astro-imagetools/components/index.js' implicitly has an 'any' type. If the 'astro-imagetools' package actually exposes this module, try adding a new declaration (.d.ts) file containingdeclare module 'astro-imagetools/components';`

I am using astro-imagetool version 0.6.10

Am I doing something wrong?

ikovac avatar Aug 09 '22 20:08 ikovac

same here. Fresh astro basics template at least in rc7 and 1.0.1, following installation steps in docs. The first time I use import picture i get the findUp not found error.

enricogallesio avatar Aug 10 '22 06:08 enricogallesio

This was working in astro beta.70, and seems to have broken somewhere between that and 1.0.1. I'm not sure why, but astro is trying to use an older version of find-up, even though this project depends on the latest ESM-only version of find-up. I started to get lots of other similar errors for other packages when updating as well, so something seems to have changed in astro for sure.

I was able to get things working by removing my node_modules and package-lock.json and re-installing. It seems like maybe semver wasn't followed entirely properly by either astro or a sub-dependency. Or npm is doing something else strange with the way it hoists packages.

If that doesn't work for you, you could try adding find-up to vite.ssr.noExternal.

IanVS avatar Aug 10 '22 14:08 IanVS

I was able to get things working by removing my node_modules and package-lock.json and re-installing.

I can confirm this workaround by @IanVS solved the build problem at least in my case. Thank you very much!!

enricogallesio avatar Aug 11 '22 05:08 enricogallesio

I'm getting the same issue, and deleting node_modules and package-log.json is not fixing it. Adding find-up to vite.ssr.noExternal also does not work.

milkyskies avatar Aug 19 '22 22:08 milkyskies

Just had this issue, using astro 1.3.0 and astro-imagetools 0.6.11. I fixed it by adding "find-up": "^6.3.0" in package.json as dev dependency, and then running npm install.

Joffreybvn avatar Sep 24 '22 18:09 Joffreybvn

Has anyone notified the Astro team on this by the way?

marcfielding1 avatar Sep 28 '22 07:09 marcfielding1

@Joffreybvn solution works for me

ikovac avatar Oct 21 '22 13:10 ikovac

Has anyone notified the Astro team on this by the way?

The astro team is building out their own official image integration, and I don't think they have any control over this package. And it seems to be unmaintained now unfortunately.

IanVS avatar Oct 21 '22 13:10 IanVS

Just had this issue, using astro 1.3.0 and astro-imagetools 0.6.11. I fixed it by adding "find-up": "^6.3.0" in package.json as dev dependency, and then running npm install.

This has worked for me, I currently using [email protected], but something strange is that if I install the dependencies with PNPM when I run pnpm build it fails, on the contrary if I use npm install, everything works fine on build.

felixicaza avatar Oct 24 '22 14:10 felixicaza