Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

motinska94's avatar

"Cannot find module \vite.js" error on "npm run build"

I just created a new laravel project and installed breeze. When I run npm run build I'm getting the following error.

  throw err;
  ^

Error: Cannot find module 'C:\Project\node_modules\vite\bin\vite.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.5.1

I updated my node to the latest version and now running npm i gives this error :

npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\Project\node_modules\tailwindcss\node_modules\sucrase',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Project\node_modules\tailwindcss\node_modules\sucrase\dist\esm\parser\plugins'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\Project\node_modules\tailwindcss\node_modules\sucrase\dist\esm\parser\plugins'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\Project\node_modules\tailwindcss',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Project\node_modules\tailwindcss\node_modules\yaml'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\Project\node_modules\tailwindcss\node_modules\yaml'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\Project\node_modules\tailwindcss\node_modules',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Project\node_modules\tailwindcss\node_modules\sucrase\dist'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\Project\node_modules\tailwindcss\node_modules\sucrase\dist'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Project\node_modules\esbuild
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm ERR! node:internal/errors:865
npm ERR!   const err = new Error(message);
npm ERR!               ^
npm ERR!
npm ERR! Error: Command failed: C:\nodejs\node.exe C:\Project\node_modules\esbuild\bin\esbuild --version
npm ERR! node:child_process:926
npm ERR!     throw err;
npm ERR!     ^
npm ERR!
npm ERR! <ref *1> Error: spawnSync C:\Project\node_modules\@esbuild\win32-x64\esbuild.exe UNKNOWN
npm ERR!     at Object.spawnSync (node:internal/child_process:1124:20)
npm ERR!     at spawnSync (node:child_process:873:24)
npm ERR!     at Object.execFileSync (node:child_process:916:15)
npm ERR!     at Object.<anonymous> (C:\Project\node_modules\esbuild\bin\esbuild:220:28)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1233:14)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1091:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:938:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
npm ERR!     at node:internal/main/run_main_module:23:47 {
npm ERR!   errno: -4094,
npm ERR!   code: 'UNKNOWN',
npm ERR!   syscall: 'spawnSync C:\Project\node_modules\@esbuild\win32-x64\esbuild.exe',
npm ERR!   path: 'C:\Project\node_modules\@esbuild\win32-x64\esbuild.exe',
npm ERR!   spawnargs: [ '--version' ],
npm ERR!   error: [Circular *1],
npm ERR!   status: null,
npm ERR!   signal: null,
npm ERR!   output: null,
npm ERR!   pid: 0,
npm ERR!   stdout: null,
npm ERR!   stderr: null
npm ERR! }
npm ERR!
npm ERR! Node.js v20.5.1
npm ERR!
npm ERR!     at checkExecSyncError (node:child_process:887:11)
npm ERR!     at Object.execFileSync (node:child_process:923:15)
npm ERR!     at validateBinaryVersion (C:\Project\node_modules\esbuild\install.js:98:28)
npm ERR!     at C:\Project\node_modules\esbuild\install.js:283:5 {
npm ERR!   status: 1,
npm ERR!   signal: null,
npm ERR!      10,  60, 114, 101, 102,  32,  42,  49,  62,  32,  69, 114,
npm ERR!     114, 111, 114,  58,  32, 115, 112,  97, 119, 110,  83, 121,
npm ERR!     110,  99,  32,  67,  58,  92,  65, 114, 116, 118, 105, 110,
npm ERR!      92, 110, 111, 100, 101,  95, 109, 111, 100, 117, 108, 101,
npm ERR!     115,  92,  64, 101,
npm ERR!     ... 1056 more items
npm ERR!   ]
npm ERR! }
npm ERR!
npm ERR! Node.js v20.5.1

I don't know if it has anything to do with this, but I deleted and reinstalled xampp today.

0 likes
2 replies
MohamedTammam's avatar
Level 51

delete node_modules directory and then re-run npm i and make sure you have a permission to run this command.

2 likes

Please or to participate in this conversation.