Fontconfig error: Cannot load default config file

hello @pawlean , here are below my package.json files

{
  "name": "blog",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbo",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@types/bcrypt": "^5.0.2",
    "@types/grecaptcha": "^3.0.9",
    "@types/nodemailer": "^6.4.15",
    "babel-plugin-react-compiler": "^0.0.0-experimental-52d6685-20240815",
    "bcrypt": "^5.1.1",
    "canvas": "^2.11.2",
    "highlight.js": "^11.10.0",
    "ioredis": "^5.4.1",
    "mongoose": "^8.5.3",
    "next": "^15.0.0-rc.0",
    "next-auth": "^5.0.0-beta.18",
    "next-mdx-remote": "^5.0.0",
    "nodemailer": "^6.9.14",
    "react": "^19.0.0-rc-1eaccd82-20240816",
    "react-dom": "^19.0.0-rc-1eaccd82-20240816",
    "rehype-autolink-headings": "^7.1.0",
    "remark-gfm": "^4.0.0",
    "remark-toc": "^9.0.0",
    "TagCloud": "^2.5.0",
    "zustand": "^4.5.5"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "15.0.0-rc.0",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

and per check , there shouldn’t have the lib impact the system, and in the code , I just use the code here below to import the fonts I want, and it works for me, which shouldn’t impact the system fonts,


     import CanvasBuilder from 'canvas';  // import the node-canvas to do some of the draw actions

     .......
     const canvas= CanvasBuilder.createCanvas(width, height);
      // this fonts here below existed and path is correct
     const fontPath = path.join(process.cwd(), 'public/fonts/HostGrotesk-VariableFont_wght.ttf') 
     CanvasBuilder.registerFont(fontPath, { family: 'CustomFont' });   // import the fonts 
     const ctx = canvas.getContext('2d');
     ctx.font = `10px CustomFont,sans-serif,serif`;     // use the fonts
     .........
  

and also there are some similar reference, may can do you a favor for these issue checking : 14.04 - Fontconfig error: cannot load default config file - Ask Ubuntu