near / react-on-chain

Improved execution layer for NEAR decentralized frontend components
https://roc-docs.near.dev/
23 stars 5 forks source link

build fails with pnpm v8.5.1 #423

Closed charleslavon closed 3 weeks ago

charleslavon commented 4 weeks ago

I've retried to build several times and have been stuck on the build step of the hot-reload setup instructions

Screen Shot 2024-04-19 at 11 03 21 AM

Caleb shared this tip, but it has yet to work The issue is that the turbo/pnpm task runner isn't correctly building out the deepest child dependencies first before build up from there. If you keep running pnpm build a few times, you can usually get past all of the errors since it's a race condition issue that eventually resolves.

pavelisnear commented 4 weeks ago

@charleslavon thanks for listing this! Before running the SOURCE_PATH=near-roc-components/src pnpm dev:components you should go 2 dirs up from bos-web-engine/apps/web to bos-web-engine and run pnpm build After that the all the packages including the @bos-web-engine/ui should be visible in the monorepo scope.

calebjacob commented 3 weeks ago

Hey @pavelisnear, thanks for the response! I agree that running pnpm build in the monorepo root is the right thing to do. However, I'm still seeing this issue when doing that. Have you tried these steps?

  1. Fresh clone of git@github.com:near/bos-web-engine.git in a new directory
  2. Run pnpm i in the root
  3. Run pnpm build in the root
  4. See a mix of typescript errors each time you attempt pnpm build - it seems like there's a race condition where deeper child dependencies aren't correctly building before being depended on.

Let me know if you're seeing what I'm seeing - maybe I have something funky going on with my machine.

pavelisnear commented 3 weeks ago

Hey @calebjacob good points you've made, I can also see similar typescript errors at the @bos-web-engine/application build step. Looks like it really is a race condition we have. This is as far as I could get in handling it:

  1. Fresh clone of git@github.com:near/react-on-chain.git in a new directory
  2. cd react-on-chain and then run pnpm i
  3. First build in parallel ui and social-db by running pnpm turbo run build --filter=ui --filter=social-db The idea behind these to is to prepare the packages for a clean build of application later.
  4. Run pnpm turbo run build --filter=application since without this step the sandbox build might fail later.
  5. Run pnpm build - now we are ready to have a total build without successfully.
  6. Run SOURCE_PATH=near-roc-components/src pnpm dev:components

To be honest I'm not happy with these separate prebuilds of ui, social-db and application, so might be a better way.

calebjacob commented 3 weeks ago

Thanks for figuring those steps out @pavelisnear! I wonder if we could temporarily update our root pnpm build script to handle this complexity for us until we figure out a better solution? For example:

"build": "turbo run build --filter=ui --filter=social-db && turbo run build --filter=application && turbo run build"

Ideally, we should have a single command that is capable of building the entire monorepo.