Replies: 2 comments
-
check the NPMRC Config List https://raddy.dev/blog/how-to-fix-error-cannot-find-module-lightningcss-win32-x64-msvc-node/
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
|
Beta Was this translation helpful? Give feedback.
-
Thanks @rodri595 this solved my issue. The error appeared with a Vite version update (not sure which) on a React-Router project. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
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
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:
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
Used Package Manager
npm
Logs
No response
Validations
Beta Was this translation helpful? Give feedback.
All reactions