remix: The package `remix` can't resolve `./client` and `./server` since v0.17.1
If you install the package remix to import things from there instead of all of @remix-run/* individual packages it throw an error because it can’t resolve ./client and ./server. This only happens with the v0.17.1 and v0.17.2, the version v0.17.0 works without issues.
> node_modules/remix/browser/index.js:2:14: error: Could not resolve "./client"
2 │ export * from './client';
╵ ~~~~~~~~~~
> node_modules/remix/browser/index.js:3:14: error: Could not resolve "./server"
3 │ export * from './server';
╵ ~~~~~~~~~~
Error: Build failed with 2 errors:
node_modules/remix/browser/index.js:2:14: error: Could not resolve "./client"
node_modules/remix/browser/index.js:3:14: error: Could not resolve "./server"
I’m using the latest release of Node v14 and both npm (v7) and yarn (v1) to install the package and run the commands to build the app or run it in dev-mode.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (4 by maintainers)
I noticed that Prisma uses the
node_modules/.prismafolder instead of mutating thenode_modules/prismafolder directly. Maybe we should be doing the same and modifyingnode_modules/.remixinstead ofnode_modules/remix…The main thing we need to be sure of is that we can still treeshake the
remixpackage no matter what we’re doing.I am experiencing this error only with
yarn. Ayarn addbreaks the install every time and then I have to runyarn upgradeto fix.@mjackson I’m hopeful the
.remixapproach might solve the problem I’m having too. I am trying to use Remix with Rush + PNPM workspaces, but every time I runremix setup, it breaks builds of unrelated projects in the monorepo and I need to purge my pnpm cache and reinstall from the registry.With PNPM, node_modules for a project is hardlinked back to a central store, and I suspect some of the magic of remix setup is affecting that store.
@3stacks d’oh, no you’re not missing anything, I failed to include the script we’re using, here it is:
./bin/remix-magicClosing this now as our approach moving forward will be to use direct imports from the remix scoped package instead of the core module.
@alexblack That works beautifully! I removed patch-package because I don’t need it, but the setup was easy
Had to also
chmod +x ./bin/remix-magic.package.jsonThanks for that, that’ll serve nicely until an official solution comes
We’re using remix successfully with
yarnafter facing this error by including this in our package.json:"postinstall": "./bin/remix-magic && patch-package",As @tchak said, it happens when running a
yarn add.yarn upgradedoesn’t work for me for some reason so I have torm -rf node_modulesand run ayarn installagain and it works.