frappe / crm

The future of open source CRM
https://frappe.io/crm
GNU Affero General Public License v3.0
197 stars 101 forks source link

Build fails when running `bench init` command #204

Open mzenz opened 1 month ago

mzenz commented 1 month ago

I am trying to install the CRM module via bench init command using frappe_docker setup. I tried setting up apps.json using both main as well as develop branches.

apps.json file

[
  {
    "url": "https://github.com/frappe/erpnext.git",
    "branch": "version-15"
  },
  {
    "url": "https://github.com/frappe/crm.git",
    "branch": "main"
  }
]

Bench command

bench init \
    --apps_path=/opt/frappe/apps.json \
    --frappe-branch=${FRAPPE_BRANCH} \
    --frappe-path=${FRAPPE_PATH} \
    --no-procfile \
    --no-backups \
    --skip-redis-config-generation \
    --verbose \
    /home/frappe/frappe-bench
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...

Inter-DisplayRegular.woff2?v=3.19 referenced in /home/frappe/frappe-bench/apps/crm/frontend/src/index.css didn't resolve at build time, it will remain unchanged to be resolved at runtime
✓ 707 modules transformed.
Killed
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 137.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 137.
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 (/home/frappe/frappe-bench/apps/frappe/esbuild/esbuild.js:451:5)
    at execute (/home/frappe/frappe-bench/apps/frappe/esbuild/esbuild.js:128:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  status: 137,
  signal: null,
  output: [ null, null, null ],
  pid: 643,
  stdout: null,
  stderr: null
}
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/frappe/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 "/home/frappe/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 "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 77, in build
    bundle(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 254, in bundle
    frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env(), raise_err=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 97, in popen
    raise subprocess.CalledProcessError(return_, command)
subprocess.CalledProcessError: Command 'yarn run production --run-build-command' returned non-zero exit status 1.
subprocess.CalledProcessError: Command 'bench build' returned non-zero exit status 1.

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/bench/commands/make.py", line 75, in init
    init(
  File "/usr/local/lib/python3.11/site-packages/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/utils/system.py", line 112, in init
    build_assets(bench_path=path)
  File "/usr/local/lib/python3.11/site-packages/bench/utils/bench.py", line 380, in build_assets
    exec_cmd(command, cwd=bench_path, env=env)
  File "/usr/local/lib/python3.11/site-packages/bench/utils/__init__.py", line 178, in exec_cmd
    raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: bench build

ERROR: There was a problem while creating /home/frappe/frappe-bench
zaheer-srushty commented 3 weeks ago

I had the same error...It turns out that I ran out out RAM .. I was running on a 2GB RAM machine. To ensure build happens, go to vite.config.js in the frontend directory and set sourcemap to false.

That solved the problem for me