Frappe Crm Build error

When I try to build crm app, I got this error…
How I solve this problem?

ubuntu@db-server:~/ccl-projects/cloudycamp/apps/crm$ bench build --app crm
✔ Application Assets Linked                                                                                                                                                             


yarn run v1.22.22
$ node esbuild --production --apps crm --run-build-command
File                                                        Size

 DONE  Total Build Time: 59.263ms


Running build command for crm
$ cd frontend && yarn build
$ vite build --base=/assets/crm/frontend/ && yarn copy-html-entry
vite v4.5.3 building for production...
transforming (45) ../node_modules/frappe-ui/src/components/LoadingText.vueBrowserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
✓ 103 modules transformed.
[vite-plugin-pwa:build] [vite]: Rollup failed to resolve import "frappe-ui/frappe" from "/home/ubuntu/ccl-projects/cloudycamp/apps/crm/frontend/src/pages/Deal.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "frappe-ui/frappe" from "/home/ubuntu/ccl-projects/cloudycamp/apps/crm/frontend/src/pages/Deal.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at viteWarn (file:///home/ubuntu/ccl-projects/cloudycamp/apps/crm/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48216:27)
    at onRollupWarning (file:///home/ubuntu/ccl-projects/cloudycamp/apps/crm/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48248:9)
    at onwarn (file:///home/ubuntu/ccl-projects/cloudycamp/apps/crm/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:47976:13)
    at file:///home/ubuntu/ccl-projects/cloudycamp/apps/crm/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:24276:13
    at Object.logger [as onLog] (file:///home/ubuntu/ccl-projects/cloudycamp/apps/crm/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:25950:9)
    at ModuleLoader.handleInvalidResolvedId (file:///home/ubuntu/ccl-projects/cloudycamp/apps/crm/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:24862:26)
    at file:///home/ubuntu/ccl-projects/cloudycamp/apps/crm/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:24822:26
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 genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:882:11)
    at execSync (node:child_process:954:15)
    at run_build_command_for_apps (/home/ubuntu/ccl-projects/cloudycamp/apps/frappe/esbuild/esbuild.js:448:5)
    at execute (/home/ubuntu/ccl-projects/cloudycamp/apps/frappe/esbuild/esbuild.js:125:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 865753,
  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.
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/ccl-projects/cloudycamp/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/ubuntu/ccl-projects/cloudycamp/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/ubuntu/ccl-projects/cloudycamp/env/lib/python3.10/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/ccl-projects/cloudycamp/env/lib/python3.10/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/ccl-projects/cloudycamp/env/lib/python3.10/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/ccl-projects/cloudycamp/env/lib/python3.10/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/ccl-projects/cloudycamp/env/lib/python3.10/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/ccl-projects/cloudycamp/env/lib/python3.10/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/home/ubuntu/ccl-projects/cloudycamp/apps/frappe/frappe/commands/utils.py", line 77, in build
    bundle(
  File "/home/ubuntu/ccl-projects/cloudycamp/apps/frappe/frappe/build.py", line 255, in bundle
    frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env(), raise_err=True)
  File "/home/ubuntu/ccl-projects/cloudycamp/apps/frappe/frappe/commands/__init__.py", line 97, in popen
    raise subprocess.CalledProcessError(return_, command)
subprocess.CalledProcessError: Command 'yarn run production --apps crm --run-build-command' returned non-zero exit status 1.

Hi @Samsul ,

It looks like your build is failing because Vite can’t resolve this import in your Deal.vue file:

import Something from "frappe-ui/frappe"

Here’s what might be going wrong and how you can fix it:


1. Check if frappe-ui is installed

Run this in your terminal:

yarn list frappe-ui

If it’s not installed, just add it with:

yarn add frappe-ui

2. Double-check your import path

Open src/pages/Deal.vue and look for the line that’s importing from "frappe-ui/frappe". That path might not be valid.

You probably just need to change it to:

import { Something } from "frappe-ui"

Or whatever specific component you’re using. The frappe-ui/frappe path might not exist or might’ve changed.


3. Set up a Vite alias (if needed)

If the import path is intentional (like you’re pointing to a submodule or a custom version), you may need to add an alias in your vite.config.js:

import path from 'path'

export default {
  resolve: {
    alias: {
      'frappe-ui': path.resolve(__dirname, 'node_modules/frappe-ui')
    }
  }
}

4. Clean and rebuild

Once you’ve made the changes, it’s a good idea to wipe the node_modules and do a clean install:

rm -rf node_modules
yarn install
yarn build

Hope that helps!