satnaing / astro-paper

A minimal, accessible and SEO-friendly Astro blog theme
https://astro-paper.pages.dev/
MIT License
2.12k stars 440 forks source link

[CouldNotTransformImage] Could not transform image `/_astro/AstroPaper-v3.uaW8qzSG.png`. See the stack trace for more information. #317

Open flyingcrp opened 3 days ago

flyingcrp commented 3 days ago

hi , I followed the commands:

yarn create astro --template satnaing/astro-paper

in the documentation to initialize the project, and Upgraded the patch version of dependent packages;

yarn dev is running successfully but when i run yarn build I got the following error。

By the way, I didn't change any configuration or file . Just upgraded the minor version of the dependent package


 generating optimized images 
[CouldNotTransformImage] Could not transform image `/_astro/AstroPaper-v3.uaW8qzSG.png`. See the stack trace for more information.
  Hint:
    This is often caused by a corrupted or malformed image. Re-exporting the image from your image editor may fix this issue.
  Error reference:
    https://docs.astro.build/en/reference/errors/could-not-transform-image/
  Stack trace:
    at generateImageInternal (file:///Users/alexchen/WorkSpace/projects/blog/node_modules/astro/dist/assets/build/generate.js:131:21)
    at async file:///Users/alexchen/WorkSpace/projects/blog/node_modules/p-queue/dist/index.js:187:36
  Caused by:
  Could not find Sharp. Please install Sharp (`sharp`) manually into your project or migrate to another image service.
    at loadSharp (file:///Users/alexchen/WorkSpace/projects/blog/dist/chunks/astro/assets-service_JerruTv0.mjs:504:11)
    at async generateImageInternal (file:///Users/alexchen/WorkSpace/projects/blog/node_modules/astro/dist/assets/build/generate.js:125:26)
    at async file:///Users/alexchen/WorkSpace/projects/blog/node_modules/p-queue/dist/index.js:187:36
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

my package.json

{
  "name": "astro-blog",
  "version": "4.2.0",
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro check && astro build && jampack ./dist",
    "preview": "astro preview",
    "sync": "astro sync",
    "astro": "astro",
    "format:check": "prettier --check . --plugin=prettier-plugin-astro",
    "format": "prettier --write . --plugin=prettier-plugin-astro",
    "cz": "cz",
    "prepare": "husky install",
    "lint": "eslint ."
  },
  "dependencies": {
    "@astrojs/check": "^0.7.0",
    "@astrojs/rss": "^4.0.7",
    "@resvg/resvg-js": "^2.6.2",
    "astro": "^4.11.3",
    "fuse.js": "^7.0.0",
    "github-slugger": "^2.0.0",
    "remark-collapse": "^0.1.2",
    "remark-toc": "^9.0.0",
    "satori": "^0.10.13",
    "tailwindcss": "^3.4.4",
    "typescript": "^5.5.2"
  },
  "devDependencies": {
    "@astrojs/react": "^3.6.0",
    "@astrojs/sitemap": "^3.1.6",
    "@astrojs/tailwind": "^5.1.0",
    "@divriots/jampack": "^0.24.4",
    "@tailwindcss/typography": "^0.5.13",
    "@types/github-slugger": "^1.3.0",
    "@types/react": "^18.3.3",
    "@typescript-eslint/parser": "^6.21.0",
    "astro-eslint-parser": "^0.17.0",
    "commitizen": "^4.3.0",
    "cz-conventional-changelog": "^3.3.0",
    "eslint": "^8.57.0",
    "eslint-plugin-astro": "^0.34.0",
    "husky": "^8.0.3",
    "lint-staged": "^15.2.7",
    "prettier": "^3.3.2",
    "prettier-plugin-astro": "^0.14.0",
    "prettier-plugin-tailwindcss": "^0.6.5",
    "react": "^18.3.1",
    "react-dom": "^18.3.1"
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  },
  "lint-staged": {
    "*.{js,jsx,ts,tsx,md,mdx,json,astro}": [
      "prettier --write --plugin=prettier-plugin-astro"
    ]
  }
}

my env:

node v20.12.1
npm v10.5.0

If I've missed something, please let me know. Thank you so much。