frappe / builder

Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly
https://frappe.io/builder
GNU Affero General Public License v3.0
517 stars 153 forks source link

Build Failure: Missing TypeScript Dependency During bench get-app builder Installation #248

Closed 0yeifer closed 2 weeks ago

0yeifer commented 2 weeks ago

Context

While following the installation steps outlined in the README for the Frappe Builder application, the process fails during the bench get-app builder command. The error seems to be related to a missing TypeScript dependency, which is required for building the application.

Steps to Reproduce

  1. Start a Docker container based on frappe/bench.

    Note: this issue may not be specific to Docker-based installations, but I have not tested it in other environments).

  2. Install the Frappe Builder app using the command:
    bench get-app builder
  3. Observe the build failure during the bench build --app builder step.

Expected Behavior

The installation and build process should complete successfully as described in the README, without requiring any additional manual intervention.

Actual Behavior

The build process fails with the following error (excerpt):

    [vite:vue] [@vue/compiler-sfc] Failed to load TypeScript, which is required for resolving imported types. Please make sure "typescript" is installed as a project dependency.
For full error details, refer to the error trace above. ``` frappe@9db63f03354e:/workspace/development/frappe-bench$ bench get-app builder Getting builder $ git clone https://github.com/frappe/builder.git --depth 1 --origin upstream Cloning into 'builder'... remote: Enumerating objects: 353, done. remote: Counting objects: 100% (353/353), done. remote: Compressing objects: 100% (288/288), done. remote: Total 353 (delta 30), reused 191 (delta 18), pack-reused 0 (from 0) Receiving objects: 100% (353/353), 979.57 KiB | 3.11 MiB/s, done. Resolving deltas: 100% (30/30), done. Ignoring dependencies of builder. To install dependencies use --resolve-deps Installing builder $ /workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /workspace/development/frappe-bench/apps/builder $ yarn install --check-files yarn install v1.22.22 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning " > builder-ui@0.0.0" has unmet peer dependency "ace-builds@^1.22.0". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > @tiptap/extension-color@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > @tiptap/extension-font-family@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > @tiptap/extension-link@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > @tiptap/extension-text-style@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > @tiptap/vue-3@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > @tiptap/vue-3 > @tiptap/extension-bubble-menu@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > @tiptap/vue-3 > @tiptap/extension-floating-menu@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-highlight@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-image@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-mention@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-placeholder@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-table@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-table-cell@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-table-header@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-table-row@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-text-align@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/extension-typography@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". warning "workspace-aggregator-b93b4877-aafa-4987-aa35-37e8f10a9dcc > builder-ui > frappe-ui > @tiptap/suggestion@2.6.4" has unmet peer dependency "@tiptap/core@^2.6.4". [4/4] Building fresh packages... success Saved lockfile. $ cd frontend && yarn install yarn install v1.22.22 [1/4] Resolving packages... success Already up-to-date. Done in 0.41s. Done in 54.52s. $ bench build --app builder ✔ Application Assets Linked yarn run v1.22.22 $ node esbuild --production --apps builder --run-build-command File Size DONE Total Build Time: 164.137ms WARN Cannot connect to redis_cache to update assets_json WARN Cannot connect to redis_cache to update assets_json WARN Cannot connect to redis_cache to update assets_json Running build command for builder $ cd frontend && yarn build $ vite build --base=/assets/builder/frontend/ && yarn copy-html-entry vite v5.4.2 building for production... ✓ 24 modules transformed. x Build failed in 743ms error during build: [vite:vue] [@vue/compiler-sfc] Failed to load TypeScript, which is required for resolving imported types. Please make sure "typescript" is installed as a project dependency. /workspace/development/frappe-bench/apps/builder/node_modules/frappe-ui/src/components/Button.vue 57 | import type { ButtonProps } from './types/Button' 58 | 59 | const props = withDefaults(defineProps(), { | ^^^^^^^^^^^ 60 | theme: 'gray', 61 | size: 'sm', file: /workspace/development/frappe-bench/apps/builder/node_modules/frappe-ui/src/components/Button.vue at ScriptCompileContext.error (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:15698:11) at importSourceToScope (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18522:16) at resolveTypeFromImport (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18514:23) at innerResolveTypeReference (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18401:14) at resolveTypeReference (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18389:20) at innerResolveTypeElements (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17990:24) at resolveTypeElements (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17931:20) at resolveRuntimePropsFromType (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19556:20) at extractRuntimeProps (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19532:17) at genRuntimeProps (/workspace/development/frappe-bench/apps/builder/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19520:18) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Error: Command failed: yarn build at checkExecSyncError (node:child_process:890:11) at execSync (node:child_process:962:15) at run_build_command_for_apps (/workspace/development/frappe-bench/apps/frappe/esbuild/esbuild.js:530:3) at execute (/workspace/development/frappe-bench/apps/frappe/esbuild/esbuild.js:137:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { status: 1, signal: null, output: [ null, null, null ], pid: 4694, stdout: null, stderr: null } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. :: Command 'yarn run production --apps builder --run-build-command' returned non-zero exit status 1. :: Context: File '/workspace/development/frappe-bench/apps/frappe/frappe/commands/__init__.py', line 97 92: ) 93: 94: return_ = proc.wait() 95: 96: if return_ and raise_err: 97> raise subprocess.CalledProcessError(return_, command) 98: 99: return return_ 100: 101: 102: def call_command(cmd, context): Do you want to see the full traceback? [y/N]: y Full traceback: Traceback (most recent call last): File "/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 47, in invoke return super().invoke(ctx) ^^^^^^^^^^^^^^^^^^^ File "/workspace/development/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 "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/development/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspace/development/frappe-bench/apps/frappe/frappe/commands/utils.py", line 88, in build bundle( File "/workspace/development/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 "/workspace/development/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 97, in popen raise subprocess.CalledProcessError(return_, command) subprocess.CalledProcessError: Command 'yarn run production --apps builder --run-build-command' returned non-zero exit status 1. Command 'yarn run production --apps builder --run-build-command' returned non-zero exit status 1. ERROR: bench build --app builder subprocess.CalledProcessError: Command 'bench build --app builder' returned non-zero exit status 1. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/frappe/.local/bin/bench", line 8, in sys.exit(cli()) ^^^^^ File "/home/frappe/.bench/bench/cli.py", line 132, in cli bench_command() File "/home/frappe/.bench/bench/commands/make.py", line 181, in get_app get_app( File "/home/frappe/.bench/bench/app.py", line 777, in get_app app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench) File "/home/frappe/.bench/bench/utils/render.py", line 126, in wrapper_fn return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/home/frappe/.bench/bench/app.py", line 254, in install install_app( File "/home/frappe/.bench/bench/app.py", line 925, in install_app build_assets(bench_path=bench_path, app=app, using_cached=using_cached) File "/home/frappe/.bench/bench/utils/bench.py", line 380, in build_assets exec_cmd(command, cwd=bench_path, env=env) File "/home/frappe/.bench/bench/utils/__init__.py", line 178, in exec_cmd raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd) bench.exceptions.CommandFailedError: bench build --app builder ```

Workaround

Adding TypeScript as a development dependency resolves the issue:

    yarn add typescript --dev

However, it is unclear if this step should be performed manually or if TypeScript should be added as a dependency in the application itself.

Environment

P-Godfroid commented 2 weeks ago

Confirmed on Ubuntu 22.04 with a non-docker version , frappe 15.47.2 and builder develop with the latest commit being 8c46dda (latest known commit at 18-11--24, 07:14)

The commit related with this issue must have been pushed between this Friday noon and this Saturday morning based on my own monitoring (some of my auto updating benches began failing at this time)

Error disappeared onbench update --reset after builder was removed from the related bench.

ajmaltridz commented 2 weeks ago

same happened to me with frappe crm

Altrix-One commented 2 weeks ago

Same problem here for Frappe Builder on Frappe Cloud.

surajshetty3416 commented 2 weeks ago

This happened due to recent changes in frappe-ui that requires typescript as peer dependency.

Fixed with: https://github.com/frappe/builder/commit/357241645c7d9105ac6f38d24a019811518423b7

surajshetty3416 commented 2 weeks ago

Same problem here for Frappe Builder on Frappe Cloud.

@Altrix-One Are you on private bench & are you using main branch?

Altrix-One commented 2 weeks ago

Same problem here for Frappe Builder on Frappe Cloud.

@Altrix-One Are you on private bench & are you using main branch?

Private branch of Frappe Builder - Develop

This has been reported all over, CRM also seems to be impacted.