after successfully installing react js with vite
after using npm i
when i write npm run dev
it show this error
npm run dev
> [email protected] dev
> vite
E:nasheednaldonode_modulesrollupdistnative.js:64
throw new Error(
^
Error: Cannot find module @rollup/rollup-win32-ia32-msvc. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
at requireWithFriendlyError (E:nasheednaldonode_modulesrollupdistnative.js:64:9)
at Object.<anonymous> (E:nasheednaldonode_modulesrollupdistnative.js:73:48)
... 2 lines matching cause stack trace ...
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at cjsLoader (node:internal/modules/esm/translators:284:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:234:7)
at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24) {
[cause]: Error: The specified module could not be found.
\?E:nasheednaldonode_modules@rolluprollup-win32-ia32-msvcrollup.win32-ia32-msvc.node
at Module._extensions..node (node:internal/modules/cjs/loader:1327:18)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at requireWithFriendlyError (E:nasheednaldonode_modulesrollupdistnative.js:62:10)
at Object.<anonymous> (E:nasheednaldonode_modulesrollupdistnative.js:73:48)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32) {
code: 'ERR_DLOPEN_FAILED'
}
}
Node.js v20.9.0
now i tried to reinstall it but it kept happening everytime.
2
Answers
download this softwere your error will be fix automatically when you install it
"Visual C++ Redistributable for Visual Studio 2015 x64"
This is the same problem I encountered 2 days ago. Just follow these steps:-
2. Restart Your System
Delete the old project & create a new one (using vite & npm)
Make sure you run
npm install
beforenpm run dev
These steps will work (most probably), this works for me.