Bhawna Sharma
Bhawna Sharma

Reputation: 161

Cannot find module @rollup/rollup-win32-x64-msvc. npm has a bug related to optional dependencies

I am facing an error while running the server after creating a vite application please help me resolve this.

enter image description here

I was learning threejs and just created a vite application with vanilla framework and javascript as the language , it was all created smoothly but npm run dev shows the error which i cant seem to resolve.

I tried installing .json file after removing but still no good.

Upvotes: 13

Views: 33155

Answers (7)

Matěj Balga
Matěj Balga

Reputation: 119

IF YOU ARE USING WINDOWS: As none of these answers helped me, I went to see the code that was causing this error and found this: vite source coude

Then, I just followed the link to get the vc++ executable, in my case https://aka.ms/vs/17/release/vc_redist.arm64.exe as I was experiencing the problem on Windows (being ran through Parallels Desktop on Mac, but I dont think that was the issue here).

Other possible options for the link mentioned are vc_redist.arm64.exe, vc_redist.x86.exe and vc_redist.x64.exe

After the installation, I reopened the PowerShell and the error was gone! Hope this helps!

Upvotes: 1

Smart Manoj
Smart Manoj

Reputation: 5851

Running npm install @rollup/rollup-win32-x64-msvc solved the issue.

Upvotes: 5

iradkot
iradkot

Reputation: 171

I had the same issue, and it was caused by importing normalizePath from the Vite library. This occurred while working with Vite v4.x and v5.x (I switched versions trying to fix it) in an Electron app on Windows. Removing the normalizePath import fixed the problem.

Upvotes: 0

MusheAbdulHakim
MusheAbdulHakim

Reputation: 364

  1. Update your dependencies with
npm update
  1. Then run npm again.
npm run dev

This worked for me

Upvotes: 6

cng.buff
cng.buff

Reputation: 583

Remove node_modules and package-lock.json is worked for me.

rm -rf node_modules package-lock.json

and then :

npm install

npm run dev

or can refer this one.

https://github.com/evanw/esbuild/issues/1646#issuecomment-2157017990

Upvotes: 7

heliya rb
heliya rb

Reputation: 830

I had this issue. you just need to delete node_module and package-lock.json and run:

npm I

this way worked for me.

Upvotes: 1

Toànn
Toànn

Reputation: 147

You can try "npm install [email protected]" or "npm install [email protected]", it will solve the issue

Upvotes: 13

Related Questions