Next.js Discord

Discord Forum

Error: UNKNOWN: unknown error

Answered
Singapura posted this in #help-forum
Open in Discord
Avatar
SingapuraOP
I just ran my npm and get this unknown error:
$ npm run dev

> ergo@0.1.0 dev
> next dev

[Error: UNKNOWN: unknown error, readlink 'C:\Users\beaur\OneDrive\Documents\programming\ergo\ergo\.next\package.json'] {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'readlink',
  path: 'C:\\Users\\beaur\\OneDrive\\Documents\\programming\\ergo\\ergo\\.next\\package.json'
}


the package.json file has this inside:
{"type": "commonjs"}

which is all. I have no idea how to fix this, but I can't run my npm dev until it's fixed
Answered by risky
can you try deleting .next folder and trying again
View full answer

22 Replies

Avatar
risky
can you try deleting .next folder and trying again
Answer
Avatar
SingapuraOP
Ah, that worked!
Thank you very much I truly appreciate the help
Why did that happen? A bug in the folder?
Avatar
risky
i think some weird cache issue, it may have gotten a bit confused when you saved a file
Avatar
SingapuraOP
okay. Thanks and thank you for the quick response
Avatar
risky
no problem 👍
Avatar
SingapuraOP
I'm sorry to bother you again. But another issue has come up
It seems like deleting the .next folder somehow deleted root layout?
I get this:
Image
But I do have a root layout for every page
which is my layout.tsx file
import './globals.css'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import Link from 'next/link'

const inter = Inter({ subsets: ['latin'] })

export const metadata: Metadata = {
  title: 'Create Next App',
  description: 'Generated by create next app',
}

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body className={inter.className}>
          <nav className="navBar">
            <p id="icon" className='welcome'>Ergo</p>
            <Link href='/'>Home</Link>
            <Link href='/notes'>Notes</Link>
            <Link href='/tasks'>Tasks</Link>
          </nav>
        {children}
      </body>
    </html>
  )
}
Which just has my navbar
@risky
(sorry about the tag I wasn't sure if you could see this since it's marked as solved)
Avatar
risky
are you sure that it is in the same folder?
Avatar
SingapuraOP
yes
Image
Avatar
risky
ahhhhhh
umm can you create a new post as its now a diferent issue (and just resend the images and code) - also as im about to go to sleep... and i think someone else should beable to help you furthere there
Avatar
SingapuraOP
okay 👍 will do. Thank you for the help