Failed to install canvas as frontend package on Mac #8164

Closed
opened 2026-02-21 18:24:17 -05:00 by yindo · 8 comments
Owner

Originally created by @bowenliang123 on GitHub (Feb 11, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. git clone the dify repo
  2. cd into web folder and cleanup npm packages installed, cd web && rm -rf node_modules
  3. install packages with yarn with lockfile unchanged, yarn install --frozen-lockfile

I'm running this on:

  • NodeJS v20.18.2
  • yarn 1.22.22
  • MacOS 15.3 with Apple M4 chip

✔️ Expected Behavior

No response

Actual Behavior

[5/5] 🔨  Building fresh packages...
[1/4] ⠠ canvas
[2/4] ⠠ sharp
[-/4] ⠠ waiting...
warning Error running install script for optional dependency: "/Users/bw/dev/dify/web/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments: 
Directory: /Users/bw/dev/dify/web/node_modules/canvas
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.11
node-pre-gyp info using node@20.18.2 | darwin | arm64
node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@20.18.2 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz 
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.18.2 | darwin | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.18.2 | darwin | arm64
gyp info find Python using Python version 3.12.8 found at \"/Users/bw/dev/dify/api/.venv/bin/python3\"

gyp info spawn /Users/bw/dev/dify/api/.venv/bin/python3
gyp info spawn args [
gyp info spawn args '/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/bw/dev/dify/web/node_modules/canvas/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/bw/Library/Caches/node-gyp/20.18.2/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/bw/Library/Caches/node-gyp/20.18.2',
gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/bw/Library/Caches/node-gyp/20.18.2/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/bw/dev/dify/web/node_modules/canvas',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangocairo.pc'
to the PKG_CONFIG_PATH environment variable
Package 'pangocairo' not found
gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.<anonymous> (/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:297:18)
gyp ERR! stack at ChildProcess.emit (node:events:518:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Darwin 24.3.0
gyp ERR! command \"/opt/homebrew/Cellar/node@20/20.18.2/bin/node\" \"/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--update-binary\" \"--module=/Users/bw/dev/dify/web/node_modules/canvas/build/Release/canvas.node\" \"--module_name=canvas\" \"--module_path=/Users/bw/dev/dify/web/node_modules/canvas/build/Release\" \"--napi_version=9\" \"--node_abi_napi=napi\" \"--napi_build_version=0\" \"--node_napi_label=node-v115\"
gyp ERR! cwd /Users/bw/dev/dify/web/node_modules/canvas
gyp ERR! node -v v20.18.2
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/opt/homebrew/Cellar/node@20/20.18.2/bin/node /opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/bw/dev/dify/web/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/bw/dev/dify/web/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/bw/dev/dify/web/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1104:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:304:5)
node-pre-gyp ERR! System Darwin 24.3.0
node-pre-gyp ERR! command \"/opt/homebrew/Cellar/node@20/20.18.2/bin/node\" \"/Users/bw/dev/dify/web/node_modules/canvas/node_modules/.bin/node-pre-gyp\" \"install\" \"--fallback-to-build\" \"--update-binary\"
node-pre-gyp ERR! cwd /Users/bw/dev/dify/web/node_modules/canvas
node-pre-gyp ERR! node -v v20.18.2
node-pre-gyp ERR! node-pre-gyp -v v1.0.11
node-pre-gyp ERR! not ok 
Failed to execute '/opt/homebrew/Cellar/node@20/20.18.2/bin/node /opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fal
$ 
Originally created by @bowenliang123 on GitHub (Feb 11, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.3 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1. git clone the dify repo 2. cd into web folder and cleanup npm packages installed, `cd web && rm -rf node_modules` 3. install packages with yarn with lockfile unchanged, `yarn install --frozen-lockfile` I'm running this on: - NodeJS v20.18.2 - yarn 1.22.22 - MacOS 15.3 with Apple M4 chip ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior ``` [5/5] 🔨 Building fresh packages... [1/4] ⠠ canvas [2/4] ⠠ sharp [-/4] ⠠ waiting... warning Error running install script for optional dependency: "/Users/bw/dev/dify/web/node_modules/canvas: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build --update-binary Arguments: Directory: /Users/bw/dev/dify/web/node_modules/canvas Output: node-pre-gyp info it worked if it ends with ok node-pre-gyp info using node-pre-gyp@1.0.11 node-pre-gyp info using node@20.18.2 | darwin | arm64 node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@20.18.2 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v115-darwin-unknown-arm64.tar.gz gyp info it worked if it ends with ok gyp info using node-gyp@10.1.0 gyp info using node@20.18.2 | darwin | arm64 gyp info ok gyp info it worked if it ends with ok gyp info using node-gyp@10.1.0 gyp info using node@20.18.2 | darwin | arm64 gyp info find Python using Python version 3.12.8 found at \"/Users/bw/dev/dify/api/.venv/bin/python3\" gyp info spawn /Users/bw/dev/dify/api/.venv/bin/python3 gyp info spawn args [ gyp info spawn args '/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/Users/bw/dev/dify/web/node_modules/canvas/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/bw/Library/Caches/node-gyp/20.18.2/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/Users/bw/Library/Caches/node-gyp/20.18.2', gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/Users/bw/Library/Caches/node-gyp/20.18.2/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/Users/bw/dev/dify/web/node_modules/canvas', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] Package pangocairo was not found in the pkg-config search path. Perhaps you should add the directory containing `pangocairo.pc' to the PKG_CONFIG_PATH environment variable Package 'pangocairo' not found gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1 gyp ERR! stack at ChildProcess.<anonymous> (/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:297:18) gyp ERR! stack at ChildProcess.emit (node:events:518:28) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12) gyp ERR! System Darwin 24.3.0 gyp ERR! command \"/opt/homebrew/Cellar/node@20/20.18.2/bin/node\" \"/opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--update-binary\" \"--module=/Users/bw/dev/dify/web/node_modules/canvas/build/Release/canvas.node\" \"--module_name=canvas\" \"--module_path=/Users/bw/dev/dify/web/node_modules/canvas/build/Release\" \"--napi_version=9\" \"--node_abi_napi=napi\" \"--napi_build_version=0\" \"--node_napi_label=node-v115\" gyp ERR! cwd /Users/bw/dev/dify/web/node_modules/canvas gyp ERR! node -v v20.18.2 gyp ERR! node-gyp -v v10.1.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/opt/homebrew/Cellar/node@20/20.18.2/bin/node /opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/bw/dev/dify/web/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/bw/dev/dify/web/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/bw/dev/dify/web/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:518:28) node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1104:16) node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:304:5) node-pre-gyp ERR! System Darwin 24.3.0 node-pre-gyp ERR! command \"/opt/homebrew/Cellar/node@20/20.18.2/bin/node\" \"/Users/bw/dev/dify/web/node_modules/canvas/node_modules/.bin/node-pre-gyp\" \"install\" \"--fallback-to-build\" \"--update-binary\" node-pre-gyp ERR! cwd /Users/bw/dev/dify/web/node_modules/canvas node-pre-gyp ERR! node -v v20.18.2 node-pre-gyp ERR! node-pre-gyp -v v1.0.11 node-pre-gyp ERR! not ok Failed to execute '/opt/homebrew/Cellar/node@20/20.18.2/bin/node /opt/homebrew/Cellar/node@20/20.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fal $ ```
yindo added the 🐞 bug label 2026-02-21 18:24:17 -05:00
yindo closed this issue 2026-02-21 18:24:17 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 11, 2025):

The error you're encountering is related to missing pre-built binaries for the canvas package and a missing pangocairo package, which is required for building canvas from source. Here are some steps you can take to resolve this issue:

  1. Install pangocairo: You can install the necessary dependencies using Homebrew. Run the following command in your terminal:

    brew install pkg-config cairo pango libpng jpeg giflib librsvg
    
  2. Set PKG_CONFIG_PATH: If you still encounter issues, you might need to set the PKG_CONFIG_PATH environment variable to help pkg-config find the installed packages. You can do this by adding the following line to your shell configuration file (e.g., .bashrc, .zshrc):

    export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig"
    
  3. Reinstall Node Modules: After installing the dependencies and setting the environment variable, try reinstalling the node modules:

    cd web
    rm -rf node_modules
    yarn install --frozen-lockfile
    

These steps should help resolve the build errors related to canvas on MacOS with ARM architecture. If the problem persists, ensure that all dependencies are correctly installed and that your environment variables are set properly.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Feb 11, 2025): <!-- Answer --> The error you're encountering is related to missing pre-built binaries for the `canvas` package and a missing `pangocairo` package, which is required for building `canvas` from source. Here are some steps you can take to resolve this issue: 1. **Install `pangocairo`:** You can install the necessary dependencies using Homebrew. Run the following command in your terminal: ```bash brew install pkg-config cairo pango libpng jpeg giflib librsvg ``` 2. **Set `PKG_CONFIG_PATH`:** If you still encounter issues, you might need to set the `PKG_CONFIG_PATH` environment variable to help `pkg-config` find the installed packages. You can do this by adding the following line to your shell configuration file (e.g., `.bashrc`, `.zshrc`): ```bash export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig" ``` 3. **Reinstall Node Modules:** After installing the dependencies and setting the environment variable, try reinstalling the node modules: ```bash cd web rm -rf node_modules yarn install --frozen-lockfile ``` These steps should help resolve the build errors related to `canvas` on MacOS with ARM architecture. If the problem persists, ensure that all dependencies are correctly installed and that your environment variables are set properly. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/df98e99e-d375-4058-b805-3d3fef6d8b17?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/df98e99e-d375-4058-b805-3d3fef6d8b17?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/df98e99e-d375-4058-b805-3d3fef6d8b17?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/df98e99e-d375-4058-b805-3d3fef6d8b17?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/df98e99e-d375-4058-b805-3d3fef6d8b17?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/df98e99e-d375-4058-b805-3d3fef6d8b17?feedback_type=other)</sup>
Author
Owner

@bowenliang123 commented on GitHub (Feb 11, 2025):

Also cc @charli117 . canvas is introduced with react-pdf-highlighter in package.json from #11466 by charli117.

The output of yarn why canvas:

yarn why v1.22.22
[1/4] 🤔  Why do we have the module "canvas"...?
[2/4] 🚚  Initialising dependency graph...
warning Resolution field "string-width@4.2.3" is incompatible with requested version "string-width@^5.0.0"
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "canvas@2.11.2"
info Reasons this module exists
   - "react-pdf-highlighter#pdfjs-dist" depends on it
   - Hoisted from "react-pdf-highlighter#pdfjs-dist#canvas"
✨  Done in 0.20s.
@bowenliang123 commented on GitHub (Feb 11, 2025): Also cc @charli117 . `canvas` is introduced with `react-pdf-highlighter` in `package.json` from #11466 by charli117. The output of `yarn why canvas`: ``` yarn why v1.22.22 [1/4] 🤔 Why do we have the module "canvas"...? [2/4] 🚚 Initialising dependency graph... warning Resolution field "string-width@4.2.3" is incompatible with requested version "string-width@^5.0.0" [3/4] 🔍 Finding dependency... [4/4] 🚡 Calculating file sizes... => Found "canvas@2.11.2" info Reasons this module exists - "react-pdf-highlighter#pdfjs-dist" depends on it - Hoisted from "react-pdf-highlighter#pdfjs-dist#canvas" ✨ Done in 0.20s. ```
Author
Owner

@linran913 commented on GitHub (Feb 17, 2025):

@bowenliang123
The most fundamental reason is that the canvas@2.11.2 did not provide a release build for the Apple M series chip ( arm64 ) before version 3.0.0. see #2036
The pdfjs-dist that react-pdf-highlighter depends on fixed this problem in versions v4.8.69 ( with 18922 ) and v4.9.124( with 19015 ). The pdfjs-dist@4.4.168 in react-pdf-highlighter@8.0.0-rc.0 (the latest version) used by dify has not yet solved this problem.

@linran913 commented on GitHub (Feb 17, 2025): @bowenliang123 The most fundamental reason is that the canvas@2.11.2 did not provide a release build for the Apple M series chip ( arm64 ) before version 3.0.0. see [#2036](https://github.com/Automattic/node-canvas/issues/2036) The pdfjs-dist that react-pdf-highlighter depends on fixed this problem in versions [v4.8.69](https://github.com/mozilla/pdf.js/releases/tag/v4.8.69) ( with [18922](https://github.com/mozilla/pdf.js/pull/18922) ) and [v4.9.124](https://github.com/mozilla/pdf.js/releases/tag/v4.9.124)( with [19015](https://github.com/mozilla/pdf.js/pull/19015) ). The pdfjs-dist@4.4.168 in react-pdf-highlighter@8.0.0-rc.0 (the latest version) used by dify has not yet solved this problem.
Author
Owner

@bowenliang123 commented on GitHub (Feb 17, 2025):

Thanks for figuring out the inside details. As you pointed out , the main reason is from react-pdf-highlighter@8.0.0-rc.0 pinning pdfjs-dist@4.4.168. Seems that we are not able to walk around from it.

@bowenliang123 commented on GitHub (Feb 17, 2025): Thanks for figuring out the inside details. As you pointed out , the main reason is from `react-pdf-highlighter@8.0.0-rc.0` pinning `pdfjs-dist@4.4.168`. Seems that we are not able to walk around from it.
Author
Owner

@linran913 commented on GitHub (Feb 17, 2025):

There is a temporary solution:

  • Delete the react-pdf-highlighter dependency in package.json and run yarn
  • run brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python-setuptools in terminal, see Compiling
  • Add dependency react-pdf-highlighter: 8.0.0-rc.0 to the corresponding location in package.json
  • Add: node-gyp: "10.1.0" to package.json
  • Run yarn again
    Give it a try. @bowenliang123
@linran913 commented on GitHub (Feb 17, 2025): There is a temporary solution: - Delete the react-pdf-highlighter dependency in `package.json` and run `yarn` - run ` brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python-setuptools` in terminal, see [Compiling](https://github.com/Automattic/node-canvas#:~:text=brew%20install%20pkg%2Dconfig%20cairo%20pango%20libpng%20jpeg%20giflib%20librsvg%20pixman%20python%2Dsetuptools) - Add dependency `react-pdf-highlighter: 8.0.0-rc.0` to the corresponding location in `package.json` - Add: `node-gyp: "10.1.0"` to `package.json` - Run `yarn` again Give it a try. @bowenliang123
Author
Owner

@bowenliang123 commented on GitHub (Feb 17, 2025):

Thanks for the hint. Seems it's a bit hacking.
And I noticed the main branch has been switched to use pnpm for packages controling.

@bowenliang123 commented on GitHub (Feb 17, 2025): Thanks for the hint. Seems it's a bit hacking. And I noticed the main branch has been switched to use pnpm for packages controling.
Author
Owner

@linran913 commented on GitHub (Feb 17, 2025):

Yes. It seems that the change from six hours ago supported pnpm. After the change, the master branch supports yarn and pnpm in parallel. I tried to install the dependencies using pnpm, and everything worked fine. canvas can be compiled and installed from source code.

hhh, this may not be a hack. You may have noticed that after the failure to fetch canvas from npm repository, node tried to run a python script to compile a version adapted to the M chip instruction set. During the compilation process, the compilation failed because some base libraries were missing (the part after the line gyp info spawn /Users/bw/dev/dify/api/.venv/bin/python). brew install installs these underlying libraries

@linran913 commented on GitHub (Feb 17, 2025): Yes. It seems that the change from [six hours ago](https://github.com/langgenius/dify/commit/403e2d58b96794727789609e41505c33374f9079) supported pnpm. After the change, the master branch supports yarn and pnpm in parallel. **I tried to install the dependencies using pnpm, and everything worked fine.** `canvas` can be compiled and installed from source code. hhh, this may not be a hack. You may have noticed that after the failure to fetch `canvas` from npm repository, node tried to run a python script to compile a version adapted to the M chip instruction set. During the compilation process, the compilation failed because some base libraries were missing (the part after the line `gyp info spawn /Users/bw/dev/dify/api/.venv/bin/python`). `brew install` installs these underlying libraries
Author
Owner

@bowenliang123 commented on GitHub (Mar 11, 2025):

BTW, this problem still exists. Pnpm just ignore the build script for canvas by default.

@bowenliang123 commented on GitHub (Mar 11, 2025): BTW, this problem still exists. Pnpm just ignore the build script for canvas by default.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8164