-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find package 'object-hash' #149
Comments
i mean :: seens it is still happening, but after manually installing missing deps it all seems fine. |
This is still happening with Astro 2.0.4 |
@djmtype @guttenbergovitz @beeb could you please share more info about your system and versions of |
Latest versions of both as of two days ago, please note I'm using |
I am also using |
@RafidMuhymin Still getting object hash error too. |
@RafidMuhymin I decided to start a blank Astro project, making sure there wasn't a conflict with this library.
Here's my Picture component. The image resides in
Note: It doesn't matter if I place and reference an image from the |
On another astro project I tried to add the But on my first repository, I still have the |
@RafidMuhymin Here's my blank Astro project with astro-imagetools: https://github.com/djmtype/astro-imagetools-test |
Just wanted to add here that @djmtype 's project is exhibiting the exact issues I had. I cloned it and downloaded all the modules it was complaining it was missing with
Until it stopped complaining about not finding things... I ran building client
Completed in 29ms.
generating static routes
▶ src/pages/index.astro
Responsive Image sets generated for Picture at /src/images/placeholder-about.jpg in 4585.597000002861ms
└─ /index.html (+4.59s)
Completed in 6.28s.
error ENOENT: no such file or directory, open '/Users/xavierruiz/Projects/astro-imagetools-test/dist/_astro/[email protected]'
Error: ENOENT: no such file or directory, open '/Users/xavierruiz/Projects/astro-imagetools-test/dist/_astro/[email protected]'
ELIFECYCLE Command failed with exit code 1. And there is not even a Using a Mac, pnpm version 7.27.0. Astro 2.0.5 |
In trying to diagnose this, I discovered there is a But I was able to come up with a workaround!!!! (I did have to install all those packages mentioned earlier (#149 (comment)) in addition to this workaround). By default Vite puts all assets in an "assets" folder (https://vitejs.dev/config/build-options.html#build-assetsdir) but for Astro it puts them in "_astro"... (https://docs.astro.build/en/reference/configuration-reference/#buildassets). So I added some logging and here was the original problem output of saving asset...
/Users/xavierruiz/Projects/astro-imagetools-test/dist/assets does not exist, creating now...
^^^ previous two lines x15
/Users/xavierruiz/Projects/astro-imagetools-test/dist/assets created successfully!
^^^ previous line x15 total
error ENOENT: no such file or directory, open '/Users/xavierruiz/Projects/astro-imagetools-test/dist/_astro/[email protected]'
Error: ENOENT: no such file or directory, open '/Users/xavierruiz/Projects/astro-imagetools-test/dist/_astro/[email protected]'
ELIFECYCLE Command failed with exit code 1.
Please note the dissonance between this library creating a So, we can workaround this by simply changing our configuration and explicitly telling Vite and Astro to match up their assets folder, please! Below is my import { defineConfig } from 'astro/config';
import { astroImageTools } from "astro-imagetools";
// https://astro.build/config
export default defineConfig({
integrations: [astroImageTools],
build: {
assets: "assets"
},
vite: {
build: {
// assetsDir: "poop" // if you uncomment this line, you have to make astro assets also "poop"
}
}
}); What this does, is tell Astro to use saving asset...
/Users/xavierruiz/Projects/astro-imagetools-test/dist/assets does not exist, creating now...
^^^ previous two lines x15
/Users/xavierruiz/Projects/astro-imagetools-test/dist/assets created successfully!
^^^ previous line x15 total
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
saved asset! => /assets/[email protected]
11:03:18 PM [build] 1 page(s) built in 7.17s
11:03:18 PM [build] Complete! Note how we are still creating an This import { defineConfig } from 'astro/config';
import { astroImageTools } from "astro-imagetools";
// https://astro.build/config
export default defineConfig({
integrations: [astroImageTools],
build: {
// assets: "poop" // same stuff as before but flipped
},
vite: {
build: {
assetsDir: "_astro"
}
}
}); but now you get this output: saving asset...
/Users/xavierruiz/Projects/astro-imagetools-test/dist/_astro does not exist, creating now...
^^^ previous two lines x15 total
/Users/xavierruiz/Projects/astro-imagetools-test/dist/_astro created successfully!
^^^ previous line x15 total
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
saved asset! => /_astro/[email protected]
11:25:01 PM [build] 1 page(s) built in 6.82s
11:25:01 PM [build] Complete! In this config, we know that Astro is going to try and save the images in Whew... I am happy I forced it to work. This was my first time messing with code in node_modules. Hopefully, someone more knowledgeable than me about how asset directories between Vite and Astro works can figure out why this dissonance is happening. |
@xav-ie Much appreciated. It all builds now. |
@xav-ie After updating to Astro 2.0.17 and Astro Imagetools 0.8.1 it looks like the issue is might just be pnpm related. Using npm instead, all builds properly even without adding all those dependencies and having to add I created a |
@xav-ie I really don't know much about pnpm, but adding a .npmrc file with I've updated my I also wanted to confirm my personal Astro project builds without any issue as well. |
Omg what a simple fix to switch to npm. Thank you so much. I tried the hoisting with minimal effort and it did not work with pnpm but ran into some other wierd issue I don't feel like figuring out. Switching to npm solved everything and I am going to stop spending anymore time on this lol. Have a nice day. |
Hello, what is the best practice for using astro-imagetools witn pnpm? I tried with
dev mode works fine, but with the build there is a issue. i tried with adding additional vite configs to astro.config.mjs but it allso doesn't work. I removed node_modules and installed all using: |
|
Astro build leads to
object-hash
error with Astro 2.0.0-beta.1Therefore, I tried installing object-hash as a separate package, but then I ended up with a different error in regards to unmet peer dependencies which made more sense since Astro 2 beta is quite new.
Regardless, if I downgrade to Astro 1.9.x, my project does compile.
The text was updated successfully, but these errors were encountered: