frappe/crm

typescript missing in production "Failed to load TypeScript, which is required for resolving imported types"

letajmal opened this issue · 2 comments

This error is breaking production deployments and I have also confirmed this with docker

This is related to issue #218 in frappe UI and issue #248 in frappe/builder

frappe-1  | Running build command for crm
frappe-1  | $ cd frontend && yarn build
frappe-1  | $ vite build --base=/assets/crm/frontend/ && yarn copy-html-entry
frappe-1  | vite v4.5.3 building for production...
frappe-1  | transforming...
frappe-1  | ✓ 29 modules transformed.
frappe-1  | [vite-plugin-pwa:build] [@vue/compiler-sfc] Failed to load TypeScript, which is required for resolving imported types. Please make sure "typescript" is installed as a project dependency.
frappe-1  |
frappe-1  | /home/frappe/frappe-bench/apps/crm/node_modules/frappe-ui/src/components/DatePicker.vue
frappe-1  | 136|  import type { DatePickerEmits, DatePickerProps } from './types/DatePicker'
frappe-1  | 137|
frappe-1  | 138|  const props = defineProps<DatePickerProps>()
frappe-1  |    |                            ^^^^^^^^^^^^^^^
frappe-1  | 139|  const emit = defineEmits<DatePickerEmits>()
frappe-1  | 140|
frappe-1  | file: /home/frappe/frappe-bench/apps/crm/node_modules/frappe-ui/src/components/DatePicker.vue
frappe-1  | error during build:
frappe-1  | Error: [@vue/compiler-sfc] Failed to load TypeScript, which is required for resolving imported types. Please make sure "typescript" is installed as a project dependency.
frappe-1  |
frappe-1  | /home/frappe/frappe-bench/apps/crm/node_modules/frappe-ui/src/components/DatePicker.vue
frappe-1  | 136|  import type { DatePickerEmits, DatePickerProps } from './types/DatePicker'
frappe-1  | 137|
frappe-1  | 138|  const props = defineProps<DatePickerProps>()
frappe-1  |    |                            ^^^^^^^^^^^^^^^
frappe-1  | 139|  const emit = defineEmits<DatePickerEmits>()
frappe-1  | 140|
frappe-1  |     at ScriptCompileContext.error (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:15575:11)
frappe-1  |     at importSourceToScope (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18382:16)
frappe-1  |     at resolveTypeFromImport (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18374:23)
frappe-1  |     at innerResolveTypeReference (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18261:14)
frappe-1  |     at resolveTypeReference (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18249:20)
frappe-1  |     at innerResolveTypeElements (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17854:24)
frappe-1  |     at resolveTypeElements (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17799:20)
frappe-1  |     at resolveRuntimePropsFromType (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19324:20)
frappe-1  |     at extractRuntimeProps (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19300:17)
frappe-1  |     at genRuntimeProps (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:19288:18)
frappe-1  |     at Object.compileScript (/home/frappe/frappe-bench/apps/crm/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:20384:21)
frappe-1  |     at resolveScript (/home/frappe/frappe-bench/apps/crm/node_modules/@vitejs/plugin-vue/dist/index.cjs:349:31)
frappe-1  |     at genScriptCode (/home/frappe/frappe-bench/apps/crm/node_modules/@vitejs/plugin-vue/dist/index.cjs:2545:18)
frappe-1  |     at transformMain (/home/frappe/frappe-bench/apps/crm/node_modules/@vitejs/plugin-vue/dist/index.cjs:2355:54)
frappe-1  |     at Object.transform (/home/frappe/frappe-bench/apps/crm/node_modules/@vitejs/plugin-vue/dist/index.cjs:2881:16)
frappe-1  |     at file:///home/frappe/frappe-bench/apps/crm/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:25544:40
frappe-1  | error Command failed with exit code 1.
frappe-1  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
frappe-1  | error Command failed with exit code 1.
frappe-1  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
frappe-1  | Error: Command failed: yarn build
frappe-1  |     at checkExecSyncError (node:child_process:890:11)
frappe-1  |     at execSync (node:child_process:962:15)
frappe-1  |     at run_build_command_for_apps (/home/frappe/frappe-bench/apps/frappe/esbuild/esbuild.js:530:3)
frappe-1  |     at execute (/home/frappe/frappe-bench/apps/frappe/esbuild/esbuild.js:137:23)
frappe-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
frappe-1  |   status: 1,
frappe-1  |   signal: null,
frappe-1  |   output: [ null, null, null ],
frappe-1  |   pid: 547,
frappe-1  |   stdout: null,
frappe-1  |   stderr: null
frappe-1  | }
frappe-1  | error Command failed with exit code 1.
frappe-1  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
frappe-1  |
frappe-1  | :: Command 'yarn run production --apps crm --run-build-command' returned non-zero exit status 1. ::
frappe-1  |
frappe-1  | Context:
frappe-1  |  File '/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py', line 97
frappe-1  |
frappe-1  |   92:       )
frappe-1  |   93:
frappe-1  |   94:       return_ = proc.wait()
frappe-1  |   95:
frappe-1  |   96:       if return_ and raise_err:
frappe-1  |   97>               raise subprocess.CalledProcessError(return_, command)
frappe-1  |   98:
frappe-1  |   99:       return return_
frappe-1  |  100:
frappe-1  |  101:
frappe-1  |  102: def call_command(cmd, context):
frappe-1  |
frappe-1  | Full traceback:
frappe-1  | Traceback (most recent call last):
frappe-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 47, in invoke
frappe-1  |     return super().invoke(ctx)
frappe-1  |            ^^^^^^^^^^^^^^^^^^^
frappe-1  |   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
frappe-1  |     return _process_result(sub_ctx.command.invoke(sub_ctx))
frappe-1  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frappe-1  |   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
frappe-1  |     return ctx.invoke(self.callback, **ctx.params)
frappe-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
frappe-1  |   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
frappe-1  |     return __callback(*args, **kwargs)
frappe-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
frappe-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 88, in build
frappe-1  |     bundle(
frappe-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 257, in bundle
frappe-1  |     frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env(), raise_err=True)
frappe-1  |   File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 97, in popen
frappe-1  |     raise subprocess.CalledProcessError(return_, command)
frappe-1  | subprocess.CalledProcessError: Command 'yarn run production --apps crm --run-build-command' returned non-zero exit status 1.
frappe-1  |
frappe-1  | Command 'yarn run production --apps crm --run-build-command' returned non-zero exit status 1.
frappe-1  | ERROR: bench build --app crm
frappe-1  | subprocess.CalledProcessError: Command 'bench build --app crm' returned non-zero exit status 1.
frappe-1  |
frappe-1  | The above exception was the direct cause of the following exception:
frappe-1  |
frappe-1  | Traceback (most recent call last):
frappe-1  |   File "/home/frappe/.local/bin/bench", line 8, in <module>
frappe-1  |     sys.exit(cli())
frappe-1  |              ^^^^^
frappe-1  |   File "/home/frappe/.bench/bench/cli.py", line 132, in cli
frappe-1  |     bench_command()
frappe-1  |   File "/home/frappe/.bench/bench/commands/make.py", line 181, in get_app
frappe-1  |     get_app(
frappe-1  |   File "/home/frappe/.bench/bench/app.py", line 777, in get_app
frappe-1  |     app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
frappe-1  |   File "/home/frappe/.bench/bench/utils/render.py", line 126, in wrapper_fn
frappe-1  |     return fn(*args, **kwargs)
frappe-1  |            ^^^^^^^^^^^^^^^^^^^
frappe-1  |   File "/home/frappe/.bench/bench/app.py", line 254, in install
frappe-1  |     install_app(
frappe-1  |   File "/home/frappe/.bench/bench/app.py", line 925, in install_app
frappe-1  |     build_assets(bench_path=bench_path, app=app, using_cached=using_cached)
frappe-1  |   File "/home/frappe/.bench/bench/utils/bench.py", line 380, in build_assets
frappe-1  |     exec_cmd(command, cwd=bench_path, env=env)
frappe-1  |   File "/home/frappe/.bench/bench/utils/__init__.py", line 178, in exec_cmd
frappe-1  |     raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
frappe-1  | bench.exceptions.CommandFailedError: bench build --app crm

same problem

closing as it has been fixed in frappe UI #218