Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem Temporarily Solved, Not Fix: Error building my application #1414

Open
zeneiltongpdev opened this issue Mar 2, 2025 · 26 comments
Open

Comments

@zeneiltongpdev
Copy link

Describe the bug

✘ [ERROR] Build failed with 5 errors:

  ✘ [ERROR] Could not resolve "child_process"

      ../build/server/index.js:25:31:
        25 │ import { execSync, exec } from 'child_process';
           ╵                                ~~~~~~~~~~~~~~~

    The package "child_process" wasn't found on the file system but is built into node. Are you
  trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this
  error.


  ✘ [ERROR] Could not resolve "crypto"

      ../build/server/index.js:29:19:
        29 │ import crypto from 'crypto';
           ╵                    ~~~~~~~~

    The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.


  ✘ [ERROR] Could not resolve "util"

      ../build/server/index.js:31:26:
        31 │ import { promisify } from 'util';
           ╵                           ~~~~~~

    The package "util" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.


  ✘ [ERROR] Could not resolve "crypto"

      ../node_modules/.pnpm/[email protected]/node_modules/cookie-signature/index.js:5:21:
        5 │ var crypto = require('crypto');
          ╵                      ~~~~~~~~

    The package "crypto" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.


  ✘ [ERROR] Could not resolve "stream"

      ../node_modules/.pnpm/[email protected]/node_modules/stream-slice/index.js:3:24:
        3 │ var Transform = require('stream').Transform;
          ╵                         ~~~~~~~~

    The package "stream" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.


✘ [ERROR] Failed to build Functions at ./functions.


🪵  Logs were written to "/home/bolt/.config/.wrangler/logs/wrangler-2025-03-02_01-55-15_331.log"
 ELIFECYCLE  Command failed with exit code 1.

Link to the Bolt URL that caused the error

https://github.com/stackblitz-labs/bolt.diy/releases/tag/v0.0.7

Steps to reproduce

pnpm run build && pnpm run start

Expected behavior

Complete build

Screen Recording / Screenshot

No response

Platform

  • OS: [Linux - Ubuntu 24.04]
  • Browser: [Chrome]
  • Version: [0.0.7]

Provider Used

No response

Model Used

No response

Additional context

No response

@kamilfurtak
Copy link

Try running app with pnpm run dev command as shown in https://github.com/stackblitz-labs/bolt.diy?tab=readme-ov-file#running-the-application
There is a problem with running it using the wrangler dev command, I described this issue here in the context of Docker at #1316 (comment)

@zeneiltongpdev
Copy link
Author

Try running app with pnpm run dev command as shown in https://github.com/stackblitz-labs/bolt.diy?tab=readme-ov-file#running-the-application There is a problem with running it using the wrangler dev command, I described this issue here in the context of Docker at #1316 (comment)

My need is really this, to build my application and make it available on my VPS. I did this with version 0.0.6 following the DIY Smart Code - @leex279 tutorial which worked super well, but now when I try to update following the same steps, I can't make it work.

Any help?

Image

@morningxm
Copy link

I also faced this issue, please help me.

@zeneiltongpdev
Copy link
Author

I also faced this issue, please help me. @morningxm

I'm going to do some new experiments today, including setting up the Wrangler to see if it works.

@leex279
Copy link
Collaborator

leex279 commented Mar 3, 2025

Hi all,
I also spent hours already on trying to get it deployed again on Cloudflare with Workers, Pages, but so far it did not work :/

Currently I try with Workers, but I stuck at this at the end:

Image

@morningxm
Copy link

I found it is impossible to use child_process on non-Node runtime like Cloudflare pages. I think it is the solution to remove app-info and git-info from Settings.

Image

@leex279
Copy link
Collaborator

leex279 commented Mar 3, 2025

but the "child-process" is used in more files and removing these files will break features.

@leex279
Copy link
Collaborator

leex279 commented Mar 3, 2025

@Stijnus @xKevIsDev @thecodacus Can we replace this child-process thing with something other or make it more optional to make the cloudflare/VPS deployment work again?

@morningxm
Copy link

morningxm commented Mar 3, 2025

@leex279 , I have removed app-info, git-info, update sections from Setting panel. so I resolved the issues with child_process, crypto, stream, util

patch api.deploy.ts 104-109

// remove import crypto
    for (const [filePath, content] of Object.entries(files)) {
      // Ensure file path starts with a forward slash
      const normalizedPath = filePath.startsWith('/') ? filePath : '/' + filePath;
      const hash = crypto.createHash('sha1').update(content).digest('hex');
      fileDigests[normalizedPath] = hash;
    }

to

    for (const [filePath, content] of Object.entries(files)) {
      // Ensure file path starts with a forward slash
      const normalizedPath = filePath.startsWith('/') ? filePath : '/' + filePath;

      // Generate SHA-1 hash using the Web Crypto API
      const encoder = new TextEncoder();
      const data = encoder.encode(content);
      const hashBuffer = await crypto.subtle.digest('SHA-1', data);
      const hashArray = Array.from(new Uint8Array(hashBuffer));
      const hashHex = hashArray.map((byte) => byte.toString(16).padStart(2, '0')).join('');

      fileDigests[normalizedPath] = hashHex;
    }

but now I have another issue

Image

Stijnus added a commit to Stijnus/bolt.diy that referenced this issue Mar 3, 2025
@Stijnus
Copy link
Collaborator

Stijnus commented Mar 3, 2025

could you test : #1436

@leex279
Copy link
Collaborator

leex279 commented Mar 3, 2025

@morningxm yeah, got the same with the PR from @Stijnus. But I am confident he will find a solution for this as well :)

@Tryanks
Copy link

Tryanks commented Mar 4, 2025

could you test : #1436

Hi, just for reference, I was able to run production via PR #1436. This change effectively resolved my issue without needing to run in dev mode.

Here's the detailed process description:

I simply pulled the latest released version v0.0.7:

git clone https://github.com/stackblitz-labs/bolt.diy.git -b v0.0.7 --depth 1

Then, I built it directly:

docker build -t bolt-ai:production -t bolt-ai:latest --target bolt-ai-production .

Next, I ran it using compose:

cp .env.example .env.local
docker compose --profile production up

Then I encountered the following error related to wranger :(

❯ docker compose --profile production up
[+] Running 2/2
 ✔ Network boltdiy_default       Created                                                                                     0.1s 
 ✔ Container boltdiy-app-prod-1  Created                                                                                     0.1s 
Attaching to app-prod-1
app-prod-1  | 
app-prod-1  | > [email protected] dockerstart /app
app-prod-1  | > bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings --ip 0.0.0.0 --port 5173 --no-show-interactive-dev-session
app-prod-1  | 
app-prod-1  | 
app-prod-1  |  ⛅️ wrangler 3.108.0
app-prod-1  | --------------------
app-prod-1  | 
app-prod-1  | ✘ [ERROR] Build failed with 5 errors:
app-prod-1  | 
app-prod-1  |   ✘ [ERROR] Could not resolve "child_process"
app-prod-1  |   
app-prod-1  |       ../build/server/index.js:25:31:
app-prod-1  |         25 │ import { execSync, exec } from 'child_process';
app-prod-1  |            ╵                                ~~~~~~~~~~~~~~~
app-prod-1  |   
app-prod-1  |     The package "child_process" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
app-prod-1  |   
app-prod-1  |   
app-prod-1  |   ✘ [ERROR] Could not resolve "crypto"
app-prod-1  |   
app-prod-1  |       ../build/server/index.js:29:19:
app-prod-1  |         29 │ import crypto from 'crypto';
app-prod-1  |            ╵                    ~~~~~~~~
app-prod-1  |   
app-prod-1  |     The package "crypto" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
app-prod-1  |   
app-prod-1  |   
app-prod-1  |   ✘ [ERROR] Could not resolve "util"
app-prod-1  |   
app-prod-1  |       ../build/server/index.js:31:26:
app-prod-1  |         31 │ import { promisify } from 'util';
app-prod-1  |            ╵                           ~~~~~~
app-prod-1  |   
app-prod-1  |     The package "util" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
app-prod-1  |   
app-prod-1  |   
app-prod-1  |   ✘ [ERROR] Could not resolve "crypto"
app-prod-1  |   
app-prod-1  |       ../node_modules/.pnpm/[email protected]/node_modules/cookie-signature/index.js:5:21:
app-prod-1  |         5 │ var crypto = require('crypto');
app-prod-1  |           ╵                      ~~~~~~~~
app-prod-1  |   
app-prod-1  |     The package "crypto" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
app-prod-1  |   
app-prod-1  |   
app-prod-1  |   ✘ [ERROR] Could not resolve "stream"
app-prod-1  |   
app-prod-1  |       ../node_modules/.pnpm/[email protected]/node_modules/stream-slice/index.js:3:24:
app-prod-1  |         3 │ var Transform = require('stream').Transform;
app-prod-1  |           ╵                         ~~~~~~~~
app-prod-1  |   
app-prod-1  |     The package "stream" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
app-prod-1  |   
app-prod-1  |   
app-prod-1  | 
app-prod-1  | 
app-prod-1  | 
app-prod-1  | ✘ [ERROR] Failed to build Functions at ./functions.
app-prod-1  | 
app-prod-1  | 
app-prod-1  | 🪵  Logs were written to "/root/.config/.wrangler/logs/wrangler-2025-03-04_04-42-48_679.log"
app-prod-1  |  ELIFECYCLE  Command failed with exit code 1.
app-prod-1 exited with code 1

At this point, the only solution was to rebuild the development version.

However, with the latest PR #1436, I was able to follow the steps above again and successfully run it directly:

❯ docker compose --profile production up
[+] Running 1/1
 ✔ Container boltdiy-app-prod-1  Recreated                                                                                   0.1s 
Attaching to app-prod-1
app-prod-1  | 
app-prod-1  | > [email protected] dockerstart /app
app-prod-1  | > bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings --ip 0.0.0.0 --port 5173 --no-show-interactive-dev-session
app-prod-1  | 
app-prod-1  | 
app-prod-1  |  ⛅️ wrangler 3.108.0
app-prod-1  | --------------------
app-prod-1  | 
app-prod-1  | ✨ Compiled Worker successfully
app-prod-1  | Your Worker and resources are simulated locally via Miniflare. For more information, see: https://developers.cloudflare.com/workers/testing/local-development.
app-prod-1  | 
app-prod-1  | Your worker has access to the following bindings:
app-prod-1  | - Vars:
app-prod-1  |   - RUNNING_IN_DOCKER: "(hidden)"
app-prod-1  |   - DEFAULT_NUM_CTX: "(hidden)"
app-prod-1  | [wrangler:inf] Ready on http://0.0.0.0:5173
app-prod-1  | [wrangler:inf] - http://127.0.0.1:5173
app-prod-1  | ⎔ Starting local server...

Overall, in my test case, this PR works!

@leex279
Copy link
Collaborator

leex279 commented Mar 4, 2025

@Tryanks yes it works now. Stinjus did another Commit in the meantime, but I am not sure yet if it not broke something else (at least in the "Debug" Tab in Settings, I see that the information request is not working. But other then that it works.

Topic is also here a bit covered/discussed: https://thinktank.ottomator.ai/t/how-to-upgrade-bold-diy-to-v0-0-7-on-cloudflare/6010/8

@xKevIsDev
Copy link
Collaborator

The team has a quick fix for this in progress. Will circle back here once it has been merged

@zeneiltongpdev
Copy link
Author

@xKevIsDev So as soon as it is resolved, let us know and then we can close this issue. Thanks so much guys!

@viethoang1520
Copy link

@zeneiltongpdev please tag me if it is resolved, thank you so much.

@zeneiltongpdev
Copy link
Author

@viethoang1520 Yes bro, for me everything is working now, I am tagging you as requested, but it is possible that some errors may appear, but we will be here to help. ⚡

Follow the instructions in this Youtube Tutorial DIY Smart Code 👨‍💻, if you also want to make your own web version. But remember to change the PR for it to work normally.

Checkout with GitHub CLI Command:

gh pr checkout 1436

Special thanks to everyone who helped with this issue.

@leex279 , @Stijnus , @xKevIsDev , @Tryanks , @kamilfurtak , @morningxm

@zeneiltongpdev zeneiltongpdev changed the title Error building my application Problem Solved: Error building my application Mar 4, 2025
@morningxm
Copy link

Thank you, @zeneiltongpdev .
I have found an issue. enhancing prompt is not working on prod mode. should I create a new issue for it?

@leex279
Copy link
Collaborator

leex279 commented Mar 4, 2025

@morningxm yes open a new issue please with more details, screenshot, model you are using etc.

@leex279 leex279 reopened this Mar 4, 2025
@leex279
Copy link
Collaborator

leex279 commented Mar 4, 2025

@zeneiltongpdev I reopened. Let it please open until we merge a final solution to the main branch, which we will then also bring as hotfix to the stable branch.

@zeneiltongpdev
Copy link
Author

@zeneiltongpdev I reopened. Let it please open until we merge a final solution to the main branch, which we will then also bring as hotfix to the stable branch.

Oh! I'm so sorry @leex279, for closing without authorization. I wish I could help with the project too, so I'll be looking for solutions and new resources.
Thanks friend!

@zeneiltongpdev
Copy link
Author

Thank you, @zeneiltongpdev . I have found an issue. enhancing prompt is not working on prod mode. should I create a new issue for it?

@morningxm Alright my friend... 🤗
I will also be looking into your problem too, I hope we can solve this together. ⚡

@zeneiltongpdev zeneiltongpdev changed the title Problem Solved: Error building my application Problem Temporarily Solved, Not Fix: Error building my application Mar 4, 2025
@viethoang1520
Copy link

@leex279 have you merged the solution to the stable branch? I'm looking forward to hearing from you. Thank you so much

@leex279
Copy link
Collaborator

leex279 commented Mar 6, 2025

@viethoang1520 no, its not even on main at the moment. Just asked @thecodacus to review it again, as @Stijnus did one more fix. If this goes through his review, we can merge to main and do a hotfix for stable.

@Screenmax1234
Copy link

@viethoang1520 no, its not even on main at the moment. Just asked @thecodacus to review it again, as @Stijnus did one more fix. If this goes through his review, we can merge to main and do a hotfix for stable.

where are we right now?

Stijnus added a commit to Stijnus/bolt.diy that referenced this issue Mar 8, 2025
commit 4a851f9
Author: Stijnus <[email protected]>
Date:   Sat Mar 8 17:18:17 2025 +0100

    remove the beta label

commit 0509033
Author: Stijnus <[email protected]>
Date:   Sat Mar 8 17:09:28 2025 +0100

    Update UpdateTab.tsx

commit 7f0726a
Author: Stijnus <[email protected]>
Date:   Sat Mar 8 17:03:58 2025 +0100

    Rework the Update Tab

commit f079794
Author: Stijnus <[email protected]>
Date:   Sat Mar 8 10:28:44 2025 +0100

    Update api.enhancer.ts

commit d221150
Merge: f82c8a4 cd4a5e8
Author: Stijnus <[email protected]>
Date:   Fri Mar 7 17:30:29 2025 +0100

    Merge branch 'main' into ACT_BoltDYI_BUGFIX_1414

commit f82c8a4
Author: Stijnus <[email protected]>
Date:   Fri Mar 7 17:27:19 2025 +0100

    Update api.git-proxy.$.ts

commit 8d2fc2d
Author: Stijnus <[email protected]>
Date:   Fri Mar 7 17:24:54 2025 +0100

    Update api.git-proxy.$.ts

commit 28d397b
Author: Stijnus <[email protected]>
Date:   Fri Mar 7 17:20:44 2025 +0100

    Update api.enhancer.ts

commit dfd684c
Author: Stijnus <[email protected]>
Date:   Fri Mar 7 16:57:06 2025 +0100

    Revert api.enhancer.ts back to original code

commit 30a1d9a
Author: Stijnus <[email protected]>
Date:   Wed Mar 5 23:11:19 2025 +0100

    bugfixes

commit f987297
Author: Stijnus <[email protected]>
Date:   Tue Mar 4 23:34:44 2025 +0100

    Update api.enhancer for prompt enhancement

commit 3c9c527
Author: Stijnus <[email protected]>
Date:   Tue Mar 4 22:52:27 2025 +0100

    lm studio fix and fix for the api key

commit 80e899b
Author: Stijnus <[email protected]>
Date:   Tue Mar 4 17:34:42 2025 +0100

    fix the root.tsx and the debugtab

commit 22c2d12
Author: Stijnus <[email protected]>
Date:   Mon Mar 3 23:58:20 2025 +0100

    Update root.tsx

commit b06361a
Author: Stijnus <[email protected]>
Date:   Mon Mar 3 21:07:28 2025 +0100

    Update vite.config.ts

commit 5f80e6d
Author: Stijnus <[email protected]>
Date:   Mon Mar 3 21:03:53 2025 +0100

    fix for vite

commit 578b661
Author: Stijnus <[email protected]>
Date:   Mon Mar 3 20:52:55 2025 +0100

    Fix: error building my application stackblitz-labs#1414
thecodacus pushed a commit that referenced this issue Mar 8, 2025
* Fix: error building my application #1414

* fix for vite

* Update vite.config.ts

* Update root.tsx

* fix the root.tsx and the debugtab

* lm studio fix and fix for the api key

* Update api.enhancer for prompt enhancement

* bugfixes

* Revert api.enhancer.ts back to original code

* Update api.enhancer.ts

* Update api.git-proxy.$.ts

* Update api.git-proxy.$.ts

* Update api.enhancer.ts
@thecodacus
Copy link
Collaborator

fix is merged please try the latest main branch
thanks @Stijnus for the fix

thecodacus pushed a commit that referenced this issue Mar 10, 2025
* Fix: error building my application #1414

* fix for vite

* Update vite.config.ts

* Update root.tsx

* fix the root.tsx and the debugtab

* lm studio fix and fix for the api key

* Update api.enhancer for prompt enhancement

* bugfixes

* Revert api.enhancer.ts back to original code

* Update api.enhancer.ts

* Update api.git-proxy.$.ts

* Update api.git-proxy.$.ts

* Update api.enhancer.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants