Giter Site home page Giter Site logo

Comments (8)

maharshivpatel avatar maharshivpatel commented on May 20, 2024

Can you please share the frappe framework version you are using? also share the steps that you followed.

from print_designer.

ratha7129 avatar ratha7129 commented on May 20, 2024

i also ran into this problem when running bench get-app my frappe version is 14.39.0

from print_designer.

delnxintl avatar delnxintl commented on May 20, 2024

Can you please share the frappe framework version you are using? also share the steps that you followed.

All I did is get-app print_designer. I could resolve this issue by installing the following dependancies

sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

and

export PKG_CONFIG_PATH=/usr/lib/pkgconfig

after doing this, I tried again and it worked. Thank you.

from print_designer.

maharshivpatel avatar maharshivpatel commented on May 20, 2024

Please note that print designer is only compatible with develop version of frappe framework. v14 is not supported as this app requires vue3.

from print_designer.

alexleach avatar alexleach commented on May 20, 2024

Hi, I had the same issue myself, on Mac OSX running frappe_docker containers from VSCode, which acts as my dev server.

I also managed to get around this by installing the apps @delnxintl listed above, however I wonder if there is a more permanent and cleaner solution? Installing those apps as root in my docker container every time it is rebuilt or updated isn't ideal, and leads to quite a lot of container image bloat in the writeable layer.

There seems to be a 404 when it tries downloading pre-built binaries of canvas:

node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-linux-glibc-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-v108-linux-glibc-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v108 ABI, glibc) (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-v108-linux-glibc-arm64.tar.gz 

I'm not sure where it gets that URL from; in print_designer's yarn.lock file, the canvas package details are:-

canvas@^2.11.0:
  version "2.11.2"
  resolved "https://registry.yarnpkg.com/canvas/-/canvas-2.11.2.tgz#553d87b1e0228c7ac0fc72887c3adbac4abbd860"
  integrity sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==
  dependencies:
    "@mapbox/node-pre-gyp" "^1.0.0"
    nan "^2.17.0"
    simple-get "^3.0.3"

The full output from my running bench get-app https://github.com/frappe/print_designer is below.

frappe@a7c56d8a612b:/workspace/development/frappe-bench$ bench get-app https://github.com/frappe/print_designer
A directory for the application 'print_designer' already exists. Do you want to continue and overwrite it? [y/N]: y
INFO: App moved from apps/print_designer to archived/apps/print_designer-2024-02-09
Getting print_designer
$ git clone https://github.com/frappe/print_designer  --depth 1 --origin upstream
Cloning into 'print_designer'...
remote: Enumerating objects: 122, done.
remote: Counting objects: 100% (122/122), done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 122 (delta 8), reused 49 (delta 2), pack-reused 0
Receiving objects: 100% (122/122), 540.08 KiB | 778.00 KiB/s, done.
Resolving deltas: 100% (8/8), done.
Ignoring dependencies of https://github.com/frappe/print_designer. To install dependencies use --resolve-deps
Installing print_designer
$ /workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /workspace/development/frappe-bench/apps/print_designer 

[notice] A new release of pip is available: 23.3.2 -> 24.0
[notice] To update, run: python -m pip install --upgrade pip
$ yarn install
yarn install v1.22.21
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @interactjs/[email protected]" has unmet peer dependency "@interactjs/[email protected]".
warning " > @interactjs/[email protected]" has unmet peer dependency "@interactjs/[email protected]".
warning " > @interactjs/[email protected]" has unmet peer dependency "@interactjs/[email protected]".
warning " > @interactjs/[email protected]" has unmet peer dependency "@interactjs/[email protected]".
warning " > @interactjs/[email protected]" has unmet peer dependency "@interactjs/[email protected]".
warning " > @interactjs/[email protected]" has unmet peer dependency "@interactjs/[email protected]".
warning "@interactjs/modifiers > @interactjs/[email protected]" has unmet peer dependency "@interactjs/[email protected]".
[4/4] Building fresh packages...
warning Error running install script for optional dependency: "/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments: 
Directory: /workspace/development/frappe-bench/apps/print_designer/node_modules/canvas
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | arm64
node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-linux-glibc-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-v108-linux-glibc-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v108 ABI, glibc) (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-v108-linux-glibc-arm64.tar.gz 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm64
gyp info find Python using Python version 3.11.6 found at \"/home/frappe/.pyenv/versions/3.11.6/bin/python3\"
gyp info spawn /home/frappe/.pyenv/versions/3.11.6/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/frappe/.nvm/versions/node/v18.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   '/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/frappe/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/frappe/.cache/node-gyp/18.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=/home/frappe/.cache/node-gyp/18.18.2',
gyp info spawn args   '-Dnode_gyp_dir=/home/frappe/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/frappe/.cache/node-gyp/18.18.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/workspace/development/frappe-bench/apps/print_designer/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 pixman-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pixman-1.pc'
to the PKG_CONFIG_PATH environment variable
Package 'pixman-1', required by 'virtual:world', not found
gyp: Call to 'pkg-config pixman-1 --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.onCpExit (/home/frappe/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
gyp ERR! System Linux 6.5.11-linuxkit
gyp ERR! command \"/home/frappe/.nvm/versions/node/v18.18.2/bin/node\" \"/home/frappe/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--update-binary\" \"--module=/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas/build/Release/canvas.node\" \"--module_name=canvas\" \"--module_path=/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas/build/Release\" \"--napi_version=9\" \"--node_abi_napi=napi\" \"--napi_build_version=0\" \"--node_napi_label=node-v108\"
gyp ERR! cwd /workspace/development/frappe-bench/apps/print_designer/node_modules/canvas
gyp ERR! node -v v18.18.2
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/frappe/.nvm/versions/node/v18.18.2/bin/node /home/frappe/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/workspace/development/frappe-bench/apps/print_designer/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
node-pre-gyp ERR! System Linux 6.5.11-linuxkit
node-pre-gyp ERR! command \"/home/frappe/.nvm/versions/node/v18.18.2/bin/node\" \"/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas/node_modules/.bin/node-pre-gyp\" \"install\" \"--fallback-to-build\" \"--update-binary\"
node-pre-gyp ERR! cwd /workspace/development/frappe-bench/apps/print_designer/node_modules/canvas
node-pre-gyp ERR! node -v v18.18.2
node-pre-gyp ERR! node-pre-gyp -v v1.0.10
node-pre-gyp ERR! not ok 
Failed to execute '/home/frappe/.nvm/versions/node/v18.18.2/bin/node /home/frappe/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/workspace/development/frappe-bench/apps/print_designer/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)"
info This module is OPTIONAL, you can safely ignore this error
Done in 1.99s.
$ bench build --app print_designer
✔ Application Assets Linked                                                                                                           


yarn run v1.22.21
$ node esbuild --apps print_designer --run-build-command
✘ [ERROR] Could not resolve "canvas"

    ../print_designer/print_designer/public/js/pdf.worker.min.js:22:25511:
      22 │ ...s.DOMMatrix&&a.isNodeJS&&(globalThis.DOMMatrix=require("canvas").DOMMatrix)}();!function checkPath2D(){if(globalThis....
         ╵                                                           ~~~~~~~~

  You can mark the path "canvas" as external to exclude it from the bundle, which will remove this
  error. You can also surround this "require" call with a try/catch block to handle this failure at
  run-time instead of bundle-time.

✘ [ERROR] [plugin frappe-vue-style] Cannot read properties of undefined (reading 'outputs')

    /workspace/development/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:10:41:
      10 │       let files = get_files(result.metafile.outputs);
         ╵                                             ^

    at /workspace/development/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:10:42
    at /workspace/development/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:1052:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  This error came from the "onEnd" callback registered here:

    /workspace/development/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:9:8:
      9 │     build.onEnd((result) => {
        ╵           ~~~~~

    at setup (/workspace/development/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:9:9)
    at handlePlugins (/workspace/development/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:855:23)

 ERROR  There were some problems during build

Error: Build failed with 2 errors:
../print_designer/print_designer/public/js/pdf.worker.min.js:22:25511: ERROR: Could not resolve "canvas"
/workspace/development/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:10:41: ERROR: [plugin: frappe-vue-style] Cannot read properties of undefined (reading 'outputs')
    at failureErrorWithLog (/workspace/development/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:1624:15)
    at /workspace/development/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:1266:28
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Done in 1.44s.
WARN: restart failed: Couldn't find supervisorctl in PATH
INFO: A newer version of bench is available: 5.19.0 → 5.22.0

from print_designer.

maharshivpatel avatar maharshivpatel commented on May 20, 2024

@alexleach Please check FAQ no 2

from print_designer.

alexleach avatar alexleach commented on May 20, 2024

Hi @maharshivpatel , thanks for the response. I actually have run that on my host machine, but as I have frappe / erpnext running inside of docker (using the frappe/erpnext:v15.xxx image), the host libraries aren't available inside the container. So, I have actually installed those libraries with Homebrew, as suggested, but to no effect. (So, I should remove them really...)

from print_designer.

13995595007 avatar 13995595007 commented on May 20, 2024

yarn run v1.22.21
$ node esbuild --production --apps print_designer --run-build-command
✘ [ERROR] Could not resolve "canvas"

../print_designer/print_designer/public/js/pdf.worker.min.js:22:25511:
  22 │ ...isNodeJS&&(globalThis.DOMMatrix=require("canvas").DOMMatrix)}();!function checkPath2D(){...
     ╵                                            ~~~~~~~~

You can mark the path "canvas" as external to exclude it from the bundle, which will remove this
error. You can also surround this "require" call with a try/catch block to handle this failure at
run-time instead of bundle-time.

✘ [ERROR] [plugin frappe-vue-style] Cannot read properties of undefined (reading 'outputs')

/Users/datawqb/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:10:41:
  10 │       let files = get_files(result.metafile.outputs);
     ╵                                             ^

at /Users/datawqb/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:10:42
at /Users/datawqb/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:1052:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

This error came from the "onEnd" callback registered here:

/Users/datawqb/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:9:8:
  9 │     build.onEnd((result) => {
    ╵           ~~~~~

at setup (/Users/datawqb/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:9:9)
at handlePlugins (/Users/datawqb/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:855:23)

ERROR There were some problems during build

Error: Build failed with 2 errors:
../print_designer/print_designer/public/js/pdf.worker.min.js:22:25511: ERROR: Could not resolve "canvas"
/Users/datawqb/frappe-bench/apps/frappe/esbuild/frappe-vue-style.js:10:41: ERROR: [plugin: frappe-vue-style] Cannot read properties of undefined (reading 'outputs')
at failureErrorWithLog (/Users/datawqb/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:1624:15)
at /Users/datawqb/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:1266:28
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
error Command failed with signal "SIGTERM".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/datawqb/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in
main()
File "/Users/datawqb/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
click.Group(commands=commands)(prog_name="bench")
File "/Users/datawqb/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/datawqb/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Users/datawqb/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/datawqb/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/datawqb/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/datawqb/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return _callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/datawqb/frappe-bench/apps/frappe/frappe/commands/utils.py", line 72, in build
bundle(
File "/Users/datawqb/frappe-bench/apps/frappe/frappe/build.py", line 257, in bundle
frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env(), raise_err=True)
File "/Users/datawqb/frappe-bench/apps/frappe/frappe/commands/init.py", line 97, in popen
raise subprocess.CalledProcessError(return
, command)
subprocess.CalledProcessError: Command 'yarn run production --apps print_designer --run-build-command' returned non-zero exit status 1.
ERROR: bench build --app print_designer
subprocess.CalledProcessError: Command 'bench build --app print_designer' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/homebrew/bin/bench", line 8, in
sys.exit(cli())
^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/bench/cli.py", line 132, in cli
bench_command()
File "/opt/homebrew/lib/python3.11/site-packages/bench/commands/make.py", line 181, in get_app
get_app(
File "/opt/homebrew/lib/python3.11/site-packages/bench/app.py", line 771, in get_app
app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
File "/opt/homebrew/lib/python3.11/site-packages/bench/utils/render.py", line 126, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/bench/app.py", line 254, in install
install_app(
File "/opt/homebrew/lib/python3.11/site-packages/bench/app.py", line 919, in install_app
build_assets(bench_path=bench_path, app=app, using_cached=using_cached)
File "/opt/homebrew/lib/python3.11/site-packages/bench/utils/bench.py", line 376, in build_assets
exec_cmd(command, cwd=bench_path, env=env)
File "/opt/homebrew/lib/python3.11/site-packages/bench/utils/init.py", line 169, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: bench build --app print_designer

from print_designer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.