-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Module not found: Can't resolve 'react' #181
Comments
@iaincollins does this line need to be updated now:
running it now gives errors, and there's now no react folder? |
So this is a little confusing to set up, because of how React works. The instructions are correct, but there isn't much detail for it. To run a local development copy of $ pwd
~/Development
$ ls
next-auth
next-auth-example You then need to install all dependancies in the Next.js project, then link it to the directory that contains $ pwd
~/Development
$ cd next-auth-example
$ npm i
$ npm link ../next-auth Where it gets annoying is you need to that then go into $ pwd
~/Development
$ cd next-auth
$ npm i
$ npm link ../next-auth-example/node_modules/react This is because NextAuth.js is an module that contains both server side only code but also a Universal React client library, which includes a React Hook, and anything that needs to use a Hook it needs to pull in the exact same version (not even same version number, but the same actual install) of React that the Next.js app is using. The mechanics of this are a weird bad choice by the React team who could have just nailed it to a build number, but didn't for some reason. Note: Depending on what functionality you are working on you may also need to link other libraries from the app to $ pwd
~/Development
$ cd next-auth
$ npm i
$ npm link ../next-auth-example/node_modules/mongodb Notes:
|
Ok thanks Iain, had done this a few times already this week and thought something might have changed due to recent commits. Figured out my mistake now, this error:
Came from running:
in next-auth-example instead of next-auth folder, I'm tired, it's late, thanks for the detailed answer Iain. |
While trying to set up a dev version of next-auth I got this error:
I'm pretty sure these instructions will fix it, but it took me too long to find them, so I'm creating an issue that will show up in Github search and google for the error message.
The text was updated successfully, but these errors were encountered: