Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cannot find the module @rollup/rollup-win32-x64-msvc #20334

Answered by rodri595
ishaqhaj asked this question in Q&A
Discussion options

Describe the bug

When I create a React or Angular project using Vite and try to run it, I encounter the following error:

Error: Cannot find module '@rollup/rollup-win32-x64-msvc'
It seems to be related to a known npm bug involving optional dependencies.

I downgraded to Vite 4.4.0, and the projects run without issues.

This problem occurs only on Windows 11. I tested the same setup on a Linux VM, and everything works fine there.

Reproduction

.

Steps to reproduce

vite-project@0.0.0 dev
vite

C:\Users\Ishak\OneDrive\Desktop\vite-project\node_modules\rollup\dist\native.js:64
throw new Error(
^

Error: Cannot find module @rollup/rollup-win32-x64-msvc. npm has a bug related to optional dependencies (npm/cli#4828). Please try npm i again after removing both package-lock.json and node_modules directory.
at requireWithFriendlyError (C:\Users\Ishak\OneDrive\Desktop\vite-project\node_modules\rollup\dist\native.js:64:9)
at Object. (C:\Users\Ishak\OneDrive\Desktop\vite-project\node_modules\rollup\dist\native.js:73:76)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function._load (node:internal/modules/cjs/loader:1282:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at cjsLoader (node:internal/modules/esm/translators:266:5)
at ModuleWrap. (node:internal/modules/esm/translators:200:7) {
[cause]: Error: Cannot find module '@rollup/rollup-win32-x64-msvc'
Require stack:

  • C:\Users\Ishak\OneDrive\Desktop\vite-project\node_modules\rollup\dist\native.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
    at Function._load (node:internal/modules/cjs/loader:1211:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1487:12)
    at require (node:internal/modules/helpers:135:16)
    at requireWithFriendlyError (C:\Users\Ishak\OneDrive\Desktop\vite-project\node_modules\rollup\dist\native.js:46:10)
    at Object. (C:\Users\Ishak\OneDrive\Desktop\vite-project\node_modules\rollup\dist\native.js:73:76) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\Users\Ishak\OneDrive\Desktop\vite-project\node_modules\rollup\dist\native.js'
    ]
    }
    }

Node.js v22.17.0

System Info

System:
 OS: Windows 11 10.0.26100
 CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
 Memory: 7.99 GB / 15.73 GB
 Binaries:
 Node: 22.17.0 - C:\nvm4w\nodejs\node.EXE
 npm: 11.4.2 - C:\nvm4w\nodejs\npm.CMD
 Browsers:
 Edge: Chromium (136.0.3240.92)
 npmPackages:
 @vitejs/plugin-react: ^4.5.2 => 4.6.0
 vite: ^7.0.0 => 7.0.0

Used Package Manager

npm

Logs

No response

Validations

You must be logged in to vote

check the NPMRC Config List
i follow the 2nd fix and it help me

https://raddy.dev/blog/how-to-fix-error-cannot-find-module-lightningcss-win32-x64-msvc-node/

npm config list

If you get OS = "linux" you have a problem with your configuration.

This will also give you the location of your .npmrc file. In my case it’s located under C:\Users\range.npmrc

How to fix it

  1. Open the .npmrc file located at: C:\Users"your pc user name".npmrc

  2. Change the OS from linux to win32
    os = "win32"

  3. Save the file.

Replies: 2 comments 1 reply

Comment options

check the NPMRC Config List
i follow the 2nd fix and it help me

https://raddy.dev/blog/how-to-fix-error-cannot-find-module-lightningcss-win32-x64-msvc-node/

npm config list

If you get OS = "linux" you have a problem with your configuration.

This will also give you the location of your .npmrc file. In my case it’s located under C:\Users\range.npmrc

How to fix it

  1. Open the .npmrc file located at: C:\Users"your pc user name".npmrc

  2. Change the OS from linux to win32
    os = "win32"

  3. Save the file.

You must be logged in to vote
1 reply
Comment options

YOU SAVED MY LIFE and my mental sanity.

Answer selected by ishaqhaj
Comment options

Thanks @rodri595 this solved my issue.
Annoyingly, mine was set to windows, changing it to win32 fixed the error.

The error appeared with a Vite version update (not sure which) on a React-Router project.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Converted from issue

This discussion was converted from issue #20332 on July 02, 2025 02:25.

AltStyle によって変換されたページ (->オリジナル) /