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
[Bug]: npm i remix-validated-form fails in Remix V2 #325
Comments
This is the breaking change in Remix v2 that's causing installation of this package to fail: https://remix.run/docs/en/main/start/v2#usetransition |
Seems like a pretty simple peer dep issue. Will push a fix shortly. @tjuranek, we updated all those imports quite awhile ago. Have you tried upgrading to the latest version? |
Should be fixed in 5.1.2 |
I am tracking this issue as part of our own migration to Remix v2 stable. Post migration and installing I am using forms
on a sample Login form: import type { MetaFunction } from "@remix-run/node";
import {
ValidatedForm,
validationError
} from "remix-validated-form";
import { z } from 'zod';
import { withZod } from "@remix-validated-form/with-zod";
import { FormInput } from "../components/input";
import { SubmitButton } from "../components/submit-button";
export const meta: MetaFunction = () => {
return [
{ title: "New Remix App" },
{ name: "description", content: "Welcome to Remix!" },
];
};
const LoginSchema = withZod(
z.object({
email: z.string({
required_error: "Email is required",
}).email(),
password: z.string().min(6, {
message: "Your password isn't long enough",
}),
redirectTo: z.string().default("/admin"),
}));
export default function Index() {
return (
<div>
<h1 className="text-2xl">Welcome to Remix</h1>
<ValidatedForm validator={LoginSchema} method="POST">
<input type="hidden" name="redirectTo" value="/teacher" />
<FormInput type="email" name="email" label="Email" />
<FormInput type="password" name="password" label="Password" />
<SubmitButton label="Login" />
</ValidatedForm>
</div>
);
} The above was a remix v2 app created from scratch and added Tailwind + Validated Forms to prove that the error was not something our original app was throwing. I've published the source code to my sample app on Github. Appreciate any pointers others have on this.
|
Same issue here. Found these two other issues that appear to be related: TLDR from those issues: related to the fact that remix-validated-form is pulling in an old version of remix into its own node_modules directory and that conflicts with the project's version when that version is V2. |
I think I have a fix. Could you try version |
@airjp73 Just upgraded to 5.1.4-beta.3 and all forms in my project are working. Thank you! |
Likewise, just updated to |
I still have issues when trying to use 5.1.4 and remix 2.0.1, whenever i set a
This might be due to some issue on my end, but looking at this change: The change on line 73 will (apparently, which was a surprise to me) compile down to: In 5.1.3 this compiled to: So this should probably be changed to something along the lines of: |
Published the changes for 5.1.4-beta.3 as 5.1.5. This release also includes the fix for the issue @ahockersten just mentioned. |
Hi @caiofrota! Could you provide a minimal repo with a reproduction? Both of these issues are likely due to dependency resolution issues. |
@airjp73 Thanks for the quick answer! I hadn't update the UI package. It's working like a charm! |
It sounds like the issue is resolved for everyone. 🎉 Please feel free to open another issue if the problem is still occurring in some cases. |
Hi y'all! I just had this same issue when upgrading to remix 2.4.0 with Vite 😢 |
Which packages are impacted?
remix-validated-form
@remix-validated-form/with-zod
@remix-validated-form/with-yup
zod-form-data
What version of these packages are you using?
Please provide a link to a minimal reproduction of the issue.
https://github.com/setvik/remix-validated-form-remixv2-install-fail
Steps to Reproduce the Bug or Issue
cd remix npm i remix-validated-form
Expected behavior
remix-validated-form installs successfully
Screenshots or Videos
Platform
System:
OS: macOS 13.5.2
CPU: (8) arm64 Apple M2
Memory: 134.33 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.3.0 - ~/.nvm/versions/node/v20.3.0/bin/node
npm: 9.6.7 - ~/.nvm/versions/node/v20.3.0/bin/npm
pnpm: 8.6.2 - ~/.nvm/versions/node/v20.3.0/bin/pnpm
Browsers:
Chrome: 116.0.5845.187
Edge: 117.0.2045.31
Safari: 16.6
npmPackages:
@remix-run/css-bundle: ^2.0.0 => 2.0.0
@remix-run/dev: ^2.0.0 => 2.0.0
@remix-run/eslint-config: ^2.0.0 => 2.0.0
@remix-run/node: ^2.0.0 => 2.0.0
@remix-run/react: ^2.0.0 => 2.0.0
@remix-run/serve: ^2.0.0 => 2.0.0
@types/react: ^18.2.20 => 18.2.21
@types/react-dom: ^18.2.7 => 18.2.7
eslint: ^8.38.0 => 8.49.0
isbot: ^3.6.8 => 3.6.13
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
typescript: ^5.1.6 => 5.2.2
Additional context
I assume the peer and dev dependencies need to be updated
The text was updated successfully, but these errors were encountered: