8

I have installed the next.js app. When I run the command

npm run dev

I got this error

the specified module could not be found. \?\d:\next.js\firstapp\node_modules@next\swc-win32-x64-msvc\next-swc.win32-x64-msvc.node

  • Does this answer your question? [Next failed to load SWC binary](https://stackoverflow.com/questions/69816589/next-failed-to-load-swc-binary) – juliomalves Jan 09 '22 at 17:00

2 Answers2

24

The issue is because the package is failing due to a missing library on the computer. fs-search requires Microsoft Visual C++ 2015 Redistributable (x64).

You can get the download here -> https://aka.ms/vs/17/release/vc_redist.x64.exe

OULAHTAK
  • 431
  • 3
  • 12
  • 1
    This worked well. I didn't use the babel configuration. – dev_integral Jan 09 '22 at 21:23
  • 2
    I like this answer because it lets me keep using `SWC` instead of babel – M.A Shahbazi Jan 29 '22 at 18:06
  • 1
    This is the correct answer folks - fresh install of Windows 10, Next v12 and I got the above error. Quickly installed this and just re-ran `yarn dev` and it span up perfectly – Aaron Feb 01 '22 at 14:06
  • I think this is the best answer. According to the Nextjs docs, "Next.js now uses Rust-based compiler SWC to compile JavaScript/TypeScript. This new compiler is up to 17x faster than Babel when compiling individual files and up to 5x faster Fast Refresh." Ref: https://nextjs.org/docs/messages/failed-loading-swc – SafalFrom2050 Jul 07 '22 at 22:27
  • After installing VD Redist, I removed node_modules and package-lock.json and restarted the system. In the end, I installed the npm packages again. – Mohammad Reza Ghasemi Aug 29 '22 at 07:57
10

create a .babelrc file in the root folder of your project and include

{
    "presets": ["next/babel"]
}

then restart your application.