The-Commit-Company / frappe-react-sdk

React hooks for Frappe
https://frappe-react.vercel.app
MIT License
107 stars 36 forks source link

Build fails on Frappe Cloud and Github Workflow #55

Closed chipohameja closed 8 months ago

chipohameja commented 8 months ago

I get the following error when trying to build on Frappe Cloud and Github workflow. When I run yarn build on localhost, it works well. What am I missing?

image

`$ vite build --base=/assets/aimlm/dashboard/ && yarn copy-html-entry /bin/sh: 1: vite: not found error Command failed with exit code 127. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 127. 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 (/home/runner/frappe-bench/apps/frappe/esbuild/esbuild.js:451:5) at execute (/home/runner/frappe-bench/apps/frappe/esbuild/esbuild.js:128:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { status: 127, signal: null, output: [ null, null, null ], pid: 3558, 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 "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/runner/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in main() File "/home/runner/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main click.Group(commands=commands)(prog_name="bench") File "/home/runner/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/home/runner/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/runner/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/runner/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/runner/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/runner/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/home/runner/frappe-bench/apps/frappe/frappe/commands/utils.py", line 71, in build bundle( File "/home/runner/frappe-bench/apps/frappe/frappe/build.py", line 256, in bundle frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env(), raiseerr=True) File "/home/runner/frappe-bench/apps/frappe/frappe/commands/init.py", line 97, in popen raise subprocess.CalledProcessError(return, command) subprocess.CalledProcessError: Command 'yarn run production --apps aimlm --run-build-command' returned non-zero exit status 1. ERROR: bench build --app aimlm subprocess.CalledProcessError: Command 'bench build --app aimlm' returned non-zero exit status 1.

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

Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.10.13/x64/bin/bench", line 8, in sys.exit(cli()) File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/bench/cli.py", line 132, in cli bench_command() File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/bench/commands/make.py", line 167, in get_app get_app( File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/bench/app.py", line 444, in get_app app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench) File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn return fn(*args, **kwargs) File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/bench/app.py", line 242, in install install_app( File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/bench/app.py", line 586, in install_app build_assets(bench_path=bench_path, app=app) File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/bench/utils/bench.py", line 351, in build_assets exec_cmd(command, cwd=bench_path, env={"BENCH_DEVELOPER": "1"}) File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/bench/utils/init.py", line 158, in exec_cmd raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd) bench.exceptions.CommandFailedError: bench build --app aimlm

Error: Process completed with exit code 1.`

nikkothari22 commented 8 months ago

Not related to Frappe React SDK.

But I think you haven't added Vite to your dev dependencies in your package.json, hence the error "Vite command not found"

chipohameja commented 8 months ago

Hello @nikkothari22,

Thanks for the response. I confirmed vite exists in the dev dependencies. I followed the video you did with Hussain on Build with Hussain step by step. Everything works well on local, however, I have this issue when deploying to Frappe Cloud

nikkothari22 commented 8 months ago

Can you run bench update on your local machine and check if it runs? Also check the node version on your FrappeCloud bench

chipohameja commented 8 months ago

I've checked and bench update runs. The node version on FrappeCloud is 18.16.0

chipohameja commented 8 months ago

I added && yarn before && yarn build. I realized the packages were not installed on the productions server