skip to Main Content

I have been happily building a next.js app over the last couple days without error. Today I installed the firebase npm and suddenly I am getting a strange error when I try to run "npm run dev?

ready - started server on 0.0.0.0:3002, url: http://localhost:3002
[Error: UNKNOWN: unknown error, readlink 'C:...seo-site.nextserverpages_document.js'] {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'readlink',
  path: 'C:\...\seo-site\.next\server\pages\_document.js'
}

Even if I uninstall firebase and roll the entire project back to a working build I still get the same error. If I try to run this "broken" build on another computer with the same version of node and npm it runs completely fine. I’ve tried running npm cache clean –force and npm install -g npm@latest –force several times without any luck.

I have noticed that as I change things I get the error with a different path. Sometimes it’s webpack-runtime.js sometimes its errors.js and somethimes it’s pages_document.js’

I cant find anything online or on stack overflow for an error matching this errno or syscall. Has anyone experienced this before or know what is causing this?

4

Answers


  1. Chosen as BEST ANSWER

    deleting the .next file and running npm run dev fixed the issue. I am not sure why this worked but I think it has something to do with next.js trying to use parts of a previous build when you make updates that are causing errors. deleting folder forces next to rebuild everything again.


  2. I tried to go back directories from command line and then reentered into the workplace directory and tried npm run dev. Worked for me.

    Login or Signup to reply.
  3. Right-click the project folder and from the menu choose "Open in integrated Terminal". Then try to run "npm run dev". If it still doesn’t work, go back one folder with the command "cd .." and then go back again to the project folder with "cd project folder name". Try running "npm run dev". It worked for me on both occasions. Hope this helps.

    Login or Signup to reply.
  4. Solved by restarting VS Code 🤔
    Error occurred seemingly out of nowhere, when restarting the local server with ‘npm run dev’. Just doing minor CSS changes to a component in the Nextjs project.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search