Is npx create-next-app not working because of a Global CSS issue?

I've been working on creating a new Next app using the npx create-next-app command, but I keep encountering an error without making any changes.

ERROR:

npm run dev
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ef9b8a9c9bafdfc1dec1df">[email protected]</a> dev
> next dev

    ready - started server on 0.0.0.0:3000, url: http://localhost:3000
    (node:23324) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use
    new ModuleGraph API
    (Use `node --trace-deprecation ...` to show where the warning was created)
    error - ../../#HACKYOURBIZ/test/styles/globals.css
    Global CSS cannot be imported from files other than your Custom <App>. Due to th
    e Global nature of stylesheets, and to avoid conflicts, Please move all first-pa
    rty global CSS imports to pages/_app.js. Or convert the import to Component-Leve
    l CSS (CSS Modules).
    Read more: https://nextjs.org/docs/messages/css-global
    Location: ..\..\#HACKYOURBIZ\test\pages\_app.js

Any suggestions on how to resolve this issue and get my app up and running?

My previous Next apps were functioning properly, so it's strange that this error is occurring with a new one.

Below is the package.json file for reference:

{
  "name": "test",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "12.2.0",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  },
  "devDependencies": {
    "eslint": "8.19.0",
    "eslint-config-next": "12.2.0"
  }
}

Answer №1

Finally, after thorough investigation, I have identified the root cause of the issue.

The issue stemmed from the fact that the parent directory of my project included a special character '#'. The specific location causing trouble was:

..\..\#HACKYOURBIZ\test\pages\_app.js
. Once I removed the '#' character, the compilation process ran smoothly without any errors.

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

Using Firebase Admin or the regular Firebase with Next.js

Currently, I am working on a project using Next.js and integrating Firebase. I have been successfully fetching data in my components using the Firebase package designed for frontend use. However, I recently attempted to utilize Firebase within getServerS ...

Every time I make a change to the code, Laravel's css/app.css file mysteriously vanishes from the mix-manifest.json

Whenever I make a change in my code, the line css/app.css in mix-manifest.json disappears. The only solution is to execute npm run watch or npm run dev, but the problem reoccurs each time I modify the code. Here is how my mix-manifest.json looks when eve ...

Dexie is alerting us to a problem with a call that occurs before initialization

When setting up my application, I encountered an error related to the Courses Entity Class being called before initialization in my Dexie Database. Despite checking my code, I couldn't find any issues and there was no documentation available for this ...

Is it guaranteed that npm install will consistently fetch the most recent *compatible* version of a dependency?

Even after carefully going through the documentation, I'm still a bit confused about this concept. For example, if I were to specify "dependencies": {"some_package": ^3.1.1} in my package.json, and the latest compatible version ...

Set up mongoose using npm on a Windows operating system

As I embarked on a new project using node.js and mongodb, I realized that I required the mongoose package to interact with the database. However, I encountered difficulties in installing it. Is there anyone who has faced a similar issue and found a soluti ...

"Encountering issues with Firebase deployment related to function-builder and handle-builder while working with TypeScript

I encountered 4 errors while executing firebase deploy with firebase cloud functions. The errors are originating from files that I didn't modify. node_modules/firebase-functions/lib/function-builder.d.ts:64:136 - error TS2707: Generic type 'Req ...

Is there a way to resolve this issue? (An error occurred: TypeError - res.json is not a valid function)

When attempting to add an object to my MongoDB database const response = await fetch("/api/contact", { method: "POST", body: JSON.stringify(data), headers: { "Content-Type": "application/json", }, }); I encounter the error message ...

Getting a return value from a post request in NextJs 9 Serverless: a step-by-step guide

I am currently working on a serverless application using NextJs but I have hit a roadblock when trying to retrieve a user's JWT in the return value after making a post request to my database. While everything else seems to be functioning correctly, th ...

How can I append a query parameter to the URL in NextJS?

My goal is to include a query parameter whenever I enter some text in an input field and press the ENTER key. However, I'm struggling to determine the correct placement for this query parameter to function properly. Essentially, I want my URL to show ...

Every time I look at my NPM readme data, I notice a strange symbol between each character

Being new to npm and node, I am just a hobbyist looking to understand creating, publishing, and using a module through npm. I have developed a small math library called thombsaway-maths, which you can check out. If you want to see how README.md renders i ...

Developing a collection of reusable components in a Javascript bundle for enhanced efficiency

I currently have a backend rendered page (using Django) that I want to enhance by incorporating components from PrimeVue and a markdown editor wrapped as a Vue component. Previously, we utilized some simple animations with jQuery which we included directly ...

What would occur in the event that NPM were to shut down completely?

I can't help but wonder, what would the repercussions be if NPM were to unexpectedly cease operations? With so many NodeJS projects dependent on its packages, would they all be left in a lurch? Is there even a possible recovery plan for such a scenari ...

Connecting to NextJS hosted on WSL2 through the network

I'm struggling to access my NextJs development server, which is running on WSL2, from my local network. Even after adding port 3000 to the firewall rules and testing with telnet, it still wasn't accessible right away. My search led me to this h ...

difficulty encountered when attempting to create a new react application using npx create-react-app

PS C:\Users\Khldon\Desktop\react bascs> npx create-react-app my-app Creating a new React app in C:\Users\Khldon\Desktop\react bascs\my-app. Installing packages. This might take a couple of minutes. Installi ...

Refresh the page after deploying Next.js Link

After updating to the latest version of Next.js, I noticed that when deploying (using Firebase) and trying to navigate the page, it completely refreshes, which does not happen locally. const CustomLink = ({ children, page, ...props }) => ( <Link cl ...

When navigating to the next page, MUIDataTable displays a "no matching records exist" message for server-side pagination, despite the data being successfully returned in the network tab

In my next js app, I am utilizing MUIDatatable with server-side pagination. The issue I am facing is that even though the data is correctly returned by the API for each page change, it only displays on the first page. When I try to navigate to the next pag ...

In IntelliJ Idea, ES module imports created using webpack and babel are not currently being highlighted

To ensure smooth code maintenance in the future, it is crucial to configure the environment (in my case, IntelliJ IDEA 2021.1.3) to recognize imports from custom modules located in the internal working repository. In this project, a module passed through B ...

The Next.js website displays a favicon in Chrome, but it does not appear in Brave browser

As I work on my debut next.js website, I am configuring the favicon in index.js like this: <Head> <title>Create Next App</title> <link rel="icon" href="/favicon.ico" /> </Head> Initially, all my source ...

Karma encountered an error while trying to resolve the file path for "../../services/service.ts" in the preprocessor.rollup

Currently, I am facing an issue while trying to test a testsuite using CI (Bamboo). The problem arises when deploying the fully functional application from my local system to the Bamboo server (which I do not have configuration access to). The call npm -- ...

Developing a NextJS application within an existing Firebase project

Currently, I am looking to leverage NextJS on Firebase for hosting my website. While the online resources available have guided me through setting up a NextJS app and initializing a Firebase project, my situation is slightly different. I already have exi ...