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

[vite] pnpm, remix and monorepo: Cannot resolve asset path outside of root directory #7960

Closed
1 task done
mrksbnch opened this issue Nov 10, 2023 · 4 comments
Closed
1 task done

Comments

@mrksbnch
Copy link

What version of Remix are you using?

2.2.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

  1. git clone https://github.com/mrksbnch/remix-vite-monorepo.git
  2. cd remix-vite-monorepo
  3. pnpm install
  4. pnpm run dev

The repository linked above is a bare bones repository that was created using the following steps:

  1. pnpm dlx create-turbo@latest
  2. pnpm dlx create-remix@latest --template remix-run/remix/templates/unstable-vite (inside /apps/remix)

I also deleted some unrelated folders in /apps (Next.js) and /packages to only keep the minimum.

Expected Behavior

Running pnpm run dev should run remix at http://localhost:5173/ (default Vite port).

Actual Behavior

Running pnpm run dev produces the following error:

Cannot resolve asset path "/Users/mrksbnch/dev/remix-vite-monorepo/node_modules/.pnpm/@remix-run+dev@2.2.0_@remix-run+serve@2.2.0_typescript@5.1.6_vite@4.5.0/node_modules/@remix-run/dev/dist/config/defaults/entry.server.node.tsx" outside of root directory "/Users/mrksbnch/dev/remix-vite-monorepo/apps/remix"

Running pnpm run build fails due to the same error.


I haven't tested it with other monorepos, e.g. NX, but I assume it will most likely behave the same way. If Vite isn't used, the same setup works out of the box. I tried to set the root in the vite.config.ts file (commented out) but since it already correctly identified the root according to the error message, this was unlikely to work.

@jrestall
Copy link
Contributor

Likely duplicate of #7722 and fixed in #7913 as I have a monorepo + vite working at remix-nx-monorepo.

You could test against nightly to be sure the above fixes the issue for you. pnpm up "@remix-run/*@nightly"

@mrksbnch
Copy link
Author

Thanks, I didn't see the other issue. The nightly release works for me. I'm closing this in favor of the other issue.

@vanvix
Copy link

vanvix commented Nov 13, 2023

I see this issue present on Windows 11.

I'm using node v20.9.0 and npm 10.1.0 and the only things that fixes my issues is going to workspace folder and running npx remix reveal. I've seen that solution on issue #7722.

On MacOS worked just fine with installing workspace project with:

npx create-remix@nightly --template remix-run/remix/templates/unstable-vite-express

instead of

npx create-remix@latest --template remix-run/remix/templates/unstable-vite-express

Steps to reproduce are simple

  • Create folder
  • Add pnpm-workspace.yaml
  • Add
packages:
  - workspaces/*
  • Install either @latest or @nightly version of vite-remix-express
  • When asked "Do you want to install with npm?" say No" => otherwise it will work but only for you (after you push it to github and someone else downloads it they wont be able to run the project)
  • Run pnpm install
  • Run pnpm --filter proj-name dev
  • App Starts on the port
  • When opened in browser it breaks

@mrksbnch
Copy link
Author

@vanvix I can't test this on Windows at the moment but if this issue is still present in nightly, I would suggest that you mention this in the other ticket (#7722) since it's unlikely that your comment in this duplicate issue will be noticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants