Disabling the experimental app directory feature in NextJs

I've been working on a real-life project and decided to test out the new App directory feature that comes with Next.js version 13. However, I encountered some issues such as images and fonts not loading properly. Now, I'm looking to opt out of the experimental app directory without having to reinstall next-app. As a newbie to Next.js, I could use some guidance.

Below is my next.config.js:

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

const nextConfig = {
  experimental: {
    appDir: true,
  },
  sassOptions: {
    includePaths: [path.join(__dirname, "styles")],
  },
  reactStrictMode: true,
  images: {
    loader: "akamai",
    path: "/",
  },
};

module.exports = nextConfig;

Every time I set the appDir to false, I encounter the following error:

Error: The `app` directory is experimental. To enable it, add `appDir: true` in your `next.config.js` configuration under `experimental`. Detailed information can be found at https://nextjs.org/docs/messages/experimental-app-dir-config
    at Object.findPagesDir (C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\lib\find-pages-dir.js:80:19)
    at DevServer.getRoutes (C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\server\dev\next-dev-server.js:141:59)
    at new Server (C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\server\base-server.js:115:47)
    at new NextNodeServer (C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\server\next-server.js:73:9)
    at new DevServer (C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\server\dev\next-dev-server.js:100:9)
    at NextServer.createServer (C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\server\next.js:152:24)
    at C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\server\next.js:165:42
    at async NextServer.prepare (C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\server\next.js:134:24)
    at async Server.<anonymous> (C:\Users\Favour\OneDrive\Documents\Code School\WebDevelopment\Projects\ecommerce\frontend\node_modules\next\dist\server\lib\render-server.js:92:17) {
  type: 'Error'
}

Answer №1

After reviewing the details found at https://nextjs.org/docs/messages/experimental-app-dir-config

If you are not yet ready to utilize the new app/ directory features, simply rename any existing app/ directory to a different name.

To proceed, consider renaming or deleting the app/ directory and eliminating appDir: true from your next.config.js. If the decision is made to get rid of the app/ directory, ensure that the page files are relocated to src/pages.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

jQuery Animated List - Nested items are unresponsive to clicks

Looking to create a dynamic nested list using jQuery for animations, but unsure of the best approach. Currently, I'm adjusting the length of the parent list item and revealing the nested items. The issue is that the parent item's length covers ...

Dealing with AJAX errors consistently in jQuery

Is it possible to efficiently handle 401 errors in AJAX calls and redirect to login.html without repeating the same code over and over again? if (xhr.status === 401) { location.assign('/login.html'); } I am seeking a way to manage these erro ...

a solution to the focus/blur issue in Firefox's browser bug

I have created the following script to validate if a value entered in an input field already exists in the database. $('#nome_field').blur(function(){ var field_name=$('#nome_field').val(); $.ajax({ url: " ...

Partial view encountering Dropzone JS function error

I am currently using jquery-modal by Kyle Fox and I've run into a problem. Whenever I try to open the modal window, my partial view gets loaded into it. However, I keep seeing this error in the console: Dropzone.options.dropzone is not recognized a ...

What steps can be taken to resolve the link prefetch warning in a Next.js application?

I am currently working on a Next.js application using version 13.4, and I've encountered a warning in the console: After preloading the resource at <URL>, it was not used within a few seconds of the window's load event. Please ensure that i ...

When using iOS, inserting an iFrame with a source URL (SRC) on a webpage will automatically open the URL

Currently facing a peculiar issue within a Cordova app, specifically on iOS. The scenario is: I have an HTML page with existing content. At a later stage, I fetch additional HTML from a remote source and inject it into the original HTML page. However, whe ...

Is it necessary to validate a token with each change of page?

Currently facing a dilemma while working on my react-native app. Uncertain whether I should request the server to validate the token each time the page/screen changes, such as switching from 'feed' to 'profile', or only when actual requ ...

Is there a similar function in AngularJS that is equivalent to getJSON? Just curious, as I am new to this

As a beginner in javascript, angularJS, and JQuery, I recently embarked on programming an angularJS app that involves using JQuery to fetch JSON data from a webserver. Here is the code snippet I am working with: var obj = $.getJSON( "http://something.com/ ...

Tips for updating a list of orders using keywords entered in a text input field

I have a collection of car objects and an input field that triggers a change event. When the value in the input field is updated, I want to reorganize the order of the cars. For example, if I enter "Tau" in the input box, I want the ford object to be plac ...

Utilizing NodeJS code and the SlackAPI to build a custom chatbot named PFBot

Recently, I came up with an idea for a Slack Bot that could censor inappropriate language used by users. For example, if a user types a curse word, the bot would automatically replace it with symbols based on the length of the word. Although I'm rela ...

What is the purpose of having several script tags following the creation of NextJS?

After running next build and next start, my application is still generating many JS files instead of a single entry point. I'm unsure if I missed a step as the documentation suggests this should be all that's required. https://i.stack.imgur.com/7 ...

Converting a jQuery DOM element into a string representation

Currently, I am working with a textarea that contains the contents of an HTML file. This textarea includes all elements of my HTML page such as doctype, head, html, etc. My goal is to save the content of the textarea into a DOM variable using $.parseHTML: ...

Converting dates in JavaScript to the format (d MMMMM yyyy HH:mm am) without using moment.js

Looking to convert the date "2020-02-07T16:13:38.22" to the format "d MMMMM yyyy HH:mm a" without relying on moment.js. Here is one method being utilized: const options = { day: "numeric", month: "long", year: "numeric", } var date1 = new Date ...

Developing HTML5 animation by utilizing sprite sheets

Struggling to create an engaging canvas animation with the image provided in the link below. Please take a look at https://i.stack.imgur.com/Pv2sI.jpg I'm attempting to run this sprite sheet image for a normal animation, but unfortunately, I seem to ...

What causes the namespace to shift when utilizing npm for installing a library?

I've been attempting to integrate whammy.js into a project. The initial line in the source code is window.Whammy = (function(){ yet, after running npm i and inspecting node_modules, I discovered global.Whammy = (function(){ https://github.com/anti ...

Looking for answers to a question about Handlebars in Node.js? Click on the following link to explore more

After successfully parsing my Shopify product items into a MongoDB database using a model, I am attempting to display them to the user using the express-handlebars package. However, I've encountered a small issue. I'm utilizing <td><a ...

Creating a layered image by drawing a shape over a photo in Ionic using canvas

While there are plenty of examples demonstrating how to draw on a canvas, my specific problem involves loading a photo into memory, adding a shape to exact coordinates over the photo, and then drawing/scaling the photo onto a canvas. I'm unsure of whe ...

How can I achieve a fade-in effect whenever the flag image is clicked?

A unique "international" quotes script has been created, showcasing Dutch, English, German, and French quotes. The script displays different quotes every day, with a draft-result visible in the upper right corner of this page ... The code used for this sc ...

The Facebook Like Button appears on Firefox but not on Internet Explorer due to Javascript errors

Hello everyone, I could really use some help with an issue I am facing. My Facebook like button works perfectly fine in Firefox, but when it comes to Internet Explorer, I keep encountering Javascript errors and the button doesn't show up at all: If y ...

The cdkDropList in Angular's drag and drop feature does not support the application of element styles

Just wanted to share my experience in case it helps someone else out there! I've been working on an Angular project where I needed to create a Trello-like application. To enable dragging elements from one list to another, I installed the Angular cdk ...