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
next.js built from source errors when linked to build other projects #40499
Comments
If this issue can't be fully solved, a quick fix for the second repro would be helpful since that's how I'm trying to work on another issue. |
This does not seem to be related.
Seems to be coming from a mismatching Setting this in your project's "next": "link:../../next.js/packages/next",
"react": "link:/../../next.js/node_modules/react",
"react-dom": "link:/../../next.js/node_modules/react-dom" Another way to go about this is to create your app inside the Next.js repository and use |
Both of these fixes work, thanks! I'll close it since this case is resolved. |
Continues #39778 Closes #40499 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples) Co-authored-by: Tim Neutkens <tim@timneutkens.nl> Co-authored-by: JJ Kasper <jj@jjsweb.site>
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
n/a
How are you deploying your application? (if relevant)
n/a
Describe the Bug
Next.js builds from source, but using it to build another project fails. I have gotten various errors from various ways of doing this. Building with next normally e.g. with
pnpm add next@canary
works fine, but cloning this repository, building it, and linking it from another project withpnpm add $path/packages/next
does not.I'm not sure if this is relevant, but here are warnings I get after cloning the repository and running
pnpm i
:And then later:
Running
pnpm build
in the next.js source repository afterward does not emit any warnings or errors.Expected Behavior
After building next.js from source, I should be able to build other projects with it locally.
I don't have these issues when building a next app normally, on canary or otherwise. For example:
If this is the wrong way to develop next.js from source, I'm not sure why. See also #40497 for why I might be confused.
Link to reproduction
https://github.com/rubytree33/next-build-failure
To Reproduce
Here are the steps I did to create the linked repro:
Here is the error:
Normally I don't clone the next.js repo into the one I'm working in, so here is a more normal example:
With this reproduction, the build fails at static page generation, saying
TypeError: Cannot read property 'useContext' of null
when rendering each of/
,/500
, and/404
. Here is a gist with the full error.The text was updated successfully, but these errors were encountered: