Skip to content

Conversation

divyagnan
Copy link

Related: #1140

Why

Tried to run the examples from a fresh git clone using the existing example instructions and wasn't able to.

  1. Running npm install gave the following error:
npm error code EUNSUPPORTEDPROTOCOL
npm error Unsupported URL Type "workspace:": workspace:*
  1. One of the example readmes actually had pnpm install so I tried that and it worked.
  2. However then running the dev command still failed due to not being able to find the @rivetkit/react package:
 npm run dev                                                                                                            

> [email protected] dev
> concurrently "tsx --watch src/backend/server.ts" "vite"

[0]
[0] node:internal/modules/run_main:122
[0]     triggerUncaughtException(
[0]     ^
[0] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/dk/Code/experiments/rivetkit/examples/game/node_modules/@rivetkit/actor/dist/mod.js' imported from /Users/dk/Code/experiments/rivetkit/examples/game/src/backend/registry.ts
[0]     at finalizeResolution (node:internal/modules/esm/resolve:257:11)
[0]     at moduleResolve (node:internal/modules/esm/resolve:913:10)
[0]     at defaultResolve (node:internal/modules/esm/resolve:1037:11)
[0]     at nextResolve (node:internal/modules/esm/hooks:748:28)
[0]     at resolveBase (file:///Users/dk/Code/experiments/rivetkit/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1753903454156:2:3811)
[0]     at resolveDirectory (file:///Users/dk/Code/experiments/rivetkit/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1753903454156:2:4310)
[0]     at resolveTsPaths (file:///Users/dk/Code/experiments/rivetkit/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1753903454156:2:5051)
[0]     at resolve (file:///Users/dk/Code/experiments/rivetkit/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1753903454156:2:5428)
[0]     at nextResolve (node:internal/modules/esm/hooks:748:28)
[0]     at Hooks.resolve (node:internal/modules/esm/hooks:240:30) {
[0]   code: 'ERR_MODULE_NOT_FOUND',
[0]   url: 'file:///Users/dk/Code/experiments/rivetkit/examples/game/node_modules/@rivetkit/actor/dist/mod.js'
[0] }
[0]
[0] Node.js v22.11.0
[0] Failed running 'src/backend/server.ts'
[1]
[1]   VITE v5.4.19  ready in 640 ms
[1]
[1]   ➜  Local:   http://localhost:3000/
[1]   ➜  Network: use --host to expose
[1] Error:   Failed to scan for dependencies from entries:
[1]   /Users/dk/Code/experiments/rivetkit/examples/game/src/frontend/index.html
[1]
[1]   ✘ [ERROR] Failed to resolve entry for package "@rivetkit/react". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-scan]
  1. I was able to fix this by running pnpm run build from the root directory of the repo.
  2. After getting everything installed and running some of the examples still didn't work — I was getting this cors error (in the browser):
Access to fetch at 'http://localhost:8080/registry/actors/resolve' from origin 'http://localhost:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://localhost:5173' that is not equal to the supplied origin. Have the server send the header with a valid value.
  1. Saw that some of the examples have an explicitly defined vite config to run the server at localhost:3000 (rather than the default which is localhost:5173). Updating the cors origin url in the server.ts files for these examples fixed the issue and made them work.

What does this PR do

  1. Updates the example README.md files (for all examples) with the instructions that worked
  2. Update the examples with the vite server url and cors origin url mismatches to match

Put them in separate commits bc you could also update the vite.config.ts server port url to fix the issue instead of updating the cors origin url in server.ts. Wasn't sure which would be preferred — seemed like the newer examples use the explicit port 3000 so decided to update the cors url.

Copy link

graphite-app bot commented Jul 30, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

1 participant