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

Error: Not in a Next.js app project #82

Closed
megaconfidence opened this issue Oct 9, 2024 · 6 comments · Fixed by #85
Closed

Error: Not in a Next.js app project #82

megaconfidence opened this issue Oct 9, 2024 · 6 comments · Fixed by #85
Labels
bug Something isn't working

Comments

@megaconfidence
Copy link

megaconfidence commented Oct 9, 2024

I'm trying to deploy this Nextjs template on Workers using opennext but I get this error

https://vercel.com/templates/next.js/empathic-voice-interface-starter
https://vercel.com/templates/next.js/blog-starter-kit

Building the Next.js app in the current folder (/Users/megaconfidence/Sandbox/temp/hume-evi-next-js-starter)
file:///Users/megaconfidence/Sandbox/temp/hume-evi-next-js-starter/node_modules/@opennextjs/cloudflare/dist/cli/index.mjs:7291
  throw new Error("Error: Not in a Next.js app project");
        ^

Error: Error: Not in a Next.js app project
    at file:///Users/megaconfidence/Sandbox/temp/hume-evi-next-js-starter/node_modules/@opennextjs/cloudflare/dist/cli/index.mjs:7291:9
    at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

Node.js v20.17.0
@vicb vicb added the bug Something isn't working label Oct 10, 2024
@shashankboosi
Copy link
Contributor

Hey @megaconfidence,

You are getting the issue because the adapter only supports next projects which have the next.config file. If the adapter doesn't find it, will throw the error. So to fix your issue add the next.config file. I have posted the bare minimum code with defaults below

/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;

I have raised a PR to add a detailed error going forward for other users. I hope this helps!

cc @vicb

@vicb
Copy link
Contributor

vicb commented Oct 10, 2024

@shashankboosi Thank you so much for your help!

@megaconfidence
Copy link
Author

megaconfidence commented Oct 11, 2024

Thanks @shashankboosi. I've added the config file and local dev in Nodejs works. But when I try to build for Workerd with preview:workers, I get the following error in the browser:

Here's a link to my project https://github.com/megaconfidence/next-blog-starter-worker

image

@vicb
Copy link
Contributor

vicb commented Oct 11, 2024

@shashankboosi both improved the error message and also added the blog starter app, see #86
It will be merged on the feedback is adressed

@shashankboosi
Copy link
Contributor

Hey @megaconfidence,

As @vicb said, the PR mentioned should work and it is night time here. So will try to get the PR ready for merge tomorrow. Play around with the PR till then :)

@megaconfidence
Copy link
Author

Thanks, everything seems to work as expected in the PR. Thanks for working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants