next build, appDir error
Unanswered
American black bear posted this in #help-forum
American black bearOP
I am currently upgrading an old project from 13 to 14
I have removed appDir option from next.config.js as per https://nextjs.org/docs/app/api-reference/next-config-js/appDir.
However, when I try run the build I am still getting the error "Error: > The
Anyone know what to do here?
I have removed appDir option from next.config.js as per https://nextjs.org/docs/app/api-reference/next-config-js/appDir.
However, when I try run the build I am still getting the error "Error: > The
app directory is experimental. To enable, add appDir: true to your next.config.js configuration under experimental. See https://nextjs.org/docs/messages/experimental-app-dir-config"Anyone know what to do here?
13 Replies
American black bearOP
yep i have
American black bearOP
that's weird...
could you make a minimal reproduction repository?
American black bearOP
{
"name": "skeleton-website",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@emailjs/browser": "^4.3.3",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@hcaptcha/react-hcaptcha": "^1.8.1",
"@headlessui/react": "^2.1.0",
"@heroicons/react": "^2.0.17",
"@mui/icons-material": "^5.14.3",
"@mui/lab": "^5.0.0-alpha.138",
"@mui/material": "^5.14.3",
"@portabletext/react": "^3.0.0",
"@sanity/color-input": "^3.1.0",
"@sanity/icons": "^3.2.0",
"@sanity/image-url": "^1.0.2",
"@sanity/types": "^3.9.1",
"@sanity/ui": "2.4.0",
"@sanity/vision": "^3.0.0",
"@tailwindcss/container-queries": "^0.1.1",
"@types/node": "^20.14.8",
"@types/react-dom": "^18.3.0",
"@types/react-slick": "^0.23.10",
"animate.css": "^4.1.1",
"classnames": "^2.3.2",
"clsx": "^2.0.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.4",
"formik": "^2.4.2",
"framer-motion": "^11.2.11",
"next": "^14.2.4",
"next-sanity": "^9.4.2",
"next-sanity-image": "^6.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sanitize-html": "^2.11.0",
"sanity": "3.47.1",
"sharp": "^0.33.4",
"slick-carousel": "^1.8.1",
"styled-components": "^6.1.11",
"swiper": "^11.1.4",
"tailwind-merge": "^2.3.0"
},
"devDependencies": {
"@sanity/eslint-config-studio": "^4.0.0",
"@tailwindcss/line-clamp": "^0.4.4",
"@types/react": "^18.2.20",
"@types/sanitize-html": "^2.9.0",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"prettier": "^3.3.2",
"prettier-plugin-tailwindcss": "^0.6.5",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.6"
}
}heres my package.json, just a standard app using sanity and nextjs
i know it wont build as theres a lot of breaking changes but I am just wanting to get past that initial error saying I have to enable the experimental option
it looks fine for me 

American black bearOP
full error code
function findPagesDir(dir, isAppDirEnabled) {
const pagesDir = findDir(dir, "pages") || undefined;
const appDir = findDir(dir, "app") || undefined;
if (isAppDirEnabled && appDir == null && pagesDir == null) {
throw new Error("> Couldn't find anypagesorappdirectory. Please create one under the project root");
}
if (!isAppDirEnabled) {
if (appDir != null && pagesDir == null) {
throw new Error("> Theappdirectory is experimental. To enable, addappDir: trueto yournext.config.jsconfiguration underexperimental. See https://nextjs.org/docs/messages/experimental-app-dir-config");
}
if (appDir != null && pagesDir != null) {
Log.warn("Theappdirectory is experimental. To enable, addappDir: trueto yournext.config.jsconfiguration underexperimental. See https://nextjs.org/docs/messages/experimental-app-dir-config");
}
if (pagesDir == null) {
throw new Error("> Couldn't find apagesdirectory. Please create one under the project root");
}
}
return {
pagesDir,
appDir: isAppDirEnabled ? appDir : undefined
};
}just looked at this function, I have added an empty pages folder and have gotten past that error