Skip to content
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

[3.0.0-beta.0] Missing Sharp error during build #7966

Closed
1 task
fflaten opened this issue Aug 4, 2023 · 2 comments
Closed
1 task

[3.0.0-beta.0] Missing Sharp error during build #7966

fflaten opened this issue Aug 4, 2023 · 2 comments
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@fflaten
Copy link
Contributor

fflaten commented Aug 4, 2023

What version of astro are you using?

3.0.0-beta.0

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Linux

What browser are you using?

Edge

Describe the Bug

After upgrading a project using assets feature to astro@3.0.0-beta.0, astro build fails with:

 generating optimized images 
 error   Could not find Sharp. Please install Sharp manually into your project.
  File:
    /workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/assets/generate.js:56:22
  Code:
    55 |   const imageService = await getConfiguredImageService();
    > 56 |   const resultData = await imageService.transform(
         |                      ^
      57 |     fileData,
      58 |     { ...options, src: originalImagePath },
      59 |     buildOpts.settings.config.image.service.config
  Stacktrace:
Error: Could not find Sharp. Please install Sharp manually into your project.
    at loadSharp (file:///workspaces/Website/dist/chunks/astro.7dbb7aca.mjs:3558:11)
    at async Object.transform (file:///workspaces/Website/dist/chunks/astro.7dbb7aca.mjs:3569:15)
    at async generateImage (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/assets/generate.js:56:22)
    at async generateImage (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/core/build/generate.js:154:26)
    at async generatePages (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/core/build/generate.js:141:7)
    at async staticBuild (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/core/build/static-build.js:85:7)
    at async AstroBuilder.build (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/core/build/index.js:128:5)
    at async AstroBuilder.run (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/core/build/index.js:159:7)
    at async build (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/core/build/index.js:37:3)
    at async build (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/cli/build/index.js:20:3)
    at async runCommand (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/cli/index.js:109:7)
    at async cli (file:///workspaces/Website/node_modules/.pnpm/astro@3.0.0-beta.0_@types+node@20.4.6_sass@1.64.2_typescript@5.0.4/node_modules/astro/dist/cli/index.js:142:5)

astro dev works as expected. Adding sharp as a direct dependency resolves it for now, but I don't believe it should be necessary in 3.0.

What's the expected result?

Assets feature should work with Sharp (new default) without adding as a direct dependency.
At least that's how I understand #7908 and withastro/docs#3756 (comment)

What should I do?
For 99.999% of people, nothing! This change is invisible.

Link to Minimal Reproducible Example

N/A. Stackblitz is Node v16 only.

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 4, 2023
@ematipico
Copy link
Member

This is a bug, thank you for reporting

@ematipico ematipico added - P4: important Violate documented behavior or significantly impacts performance (priority) and removed needs triage Issue needs to be triaged labels Aug 4, 2023
@withastro withastro deleted a comment from algora-pbc Aug 13, 2023
@fflaten
Copy link
Contributor Author

fflaten commented Aug 18, 2023

This should've been auto-closed. Fixed by improved error message in #8128 . Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

No branches or pull requests

2 participants