astro-imagetools: Cannot find package 'object-hash'
Astro build leads to object-hash error with Astro 2.0.0-beta.1
Cannot find package 'object-hash' imported from /Volumes/Evo/Sites/astro-content/dist/entry.mjs
Did you mean to import object-hash@3.0.0/node_modules/object-hash/index.js?
Therefore, 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.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 3
- Comments: 17 (2 by maintainers)
Commits related to this issue
- pnpm build https://github.com/RafidMuhymin/astro-imagetools/issues/149#issuecomment-1455165256 — committed to xiduzo/portfolio_astro by xiduzo a year ago
- fix https://github.com/RafidMuhymin/astro-imagetools/issues/149 — committed to maxknerrich/knerrich.com by maxknerrich a year ago
- fix: https://github.com/RafidMuhymin/astro-imagetools/issues/149 — committed to devlulcas/primeagen-anime-visualizer by devlulcas 8 months ago
- fix RafidMuhymin/astro-imagetools#149 — committed to courtyenn/engster-rides by courtyenn 8 months ago
Hello, what is the best practice for using astro-imagetools witn pnpm? I tried with
shamefully-hoist=truebut it didn’t help.error Cannot find package 'object-hash' imported from C:\www\2023\test\dist\chunks\pages\_slug__d8e98270.mjs Did you mean to import object-hash@3.0.0/node_modules/object-hash/index.js? Error: Cannot find package 'object-hash' imported from C:\www\2023\test\dist\chunks\pages\_slug__d8e98270.mjsdev 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:
pnpm install --shamefully-hoist--> now it works.@xav-ie I really don’t know much about pnpm, but adding a .npmrc file with
shamefully-hoist=trueto the root of the project seems to have magically cleared up any remaining issues. Bothbuildandpreviewwork without a problem.I’ve updated my
march-updatebranch to reflect this; now using pnpm.I also wanted to confirm my personal Astro project builds without any issue as well.
@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
vite: { build: { assetsDir: "_astro"} }to the Astro config file.I created a
march-updatebranch which uses npm. https://github.com/djmtype/astro-imagetools-test/tree/march-updateThis is still happening with Astro 2.0.4