How can I resolve this error and complete the setup for NativeWind? Any suggestions or solutions would be greatly appreciated.
Error: Cannot find module '../lightningcss.win32-x64-msvc.node' while setting up NativeWind in a React Native app
I'm encountering the following error while setting up NativeWind in my React Native app:
Error: Cannot find module '../lightningcss.win32-x64-msvc.node'
Steps I’ve Tried:
npm install to install all dependencies.
Deleted node_modules and package-lock.json using
rm -rf node_modules package-lock.json
Rebuilt lightningcss with:npm rebuild lightningcss
Cleared the npm cache:npm cache clean --force
Reinstalled dependencies with npm install.
However, the issue persists.
System Information:
Operating System: [Windows 11 64-bit] Node.js Version: [v22.11.0] npm Version: [10.9.0] React Native Version: ["0.76.6"] NativeWind Version: ["^4.1.23"]
I tried to set up NativeWind in my React Native app. After following the installation instructions, I ran npm install to install the required dependencies and made sure all necessary packages were installed. I also deleted the node_modules folder and package-lock.json file and then reinstalled the packages to fix any potential issues. Additionally, I tried rebuilding the lightningcss package and clearing the npm cache with the commands:
rm -rf node_modules package-lock.json npm rebuild lightningcss npm cache clean --force npm install
I expected these steps to resolve any dependency or package issues and allow the NativeWind setup to complete successfully.
What actually happened?
Despite following the above steps, I am still encountering the error:
Error: Cannot find module '../lightningcss.win32-x64-msvc.node'
This error occurs during the NativeWind setup in my React Native app, and I’m unable to proceed with the configuration.
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.– Community BotCommented Jan 16 at 20:05
-
This question is similar to: Tailwind CSS Oxide Error: Failed to Load tailwindcss-oxide.win32-x64-msvc.node in Vite. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.– rozsazoltanCommented Mar 3 at 16:47
4 Answers
You are likely using a newer or current version of Node.js, which may be causing the issue. I encountered the same problem and conducted extensive research before realizing that the root cause was my use of Node.js version 22.13.1. and anything less than node JS 18 will cause an error as well.
Node.js 22.13.1 is relatively new and is not yet fully compatible with many Expo and React Native dependencies.
After struggling with this issue for months, I even checked Stack Overflow, where I found others experiencing the same problem without a solution. Continuing my research, I eventually discovered that reverting to Node.js 20.18.3 resolved the issue completely.
I hope this helps!
The issue was solved after instaling Microsoft redistributable package. download from here https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
check this issue for reference
-
1As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.– Community BotCommented Apr 5 at 23:51
-
the answer may not be very clear but an intelligent person can pick it up, this actually worked for me. installing the latest Microsoft C++ Redistributable is the correct approach Commented 12 hours ago
After trying different things , at the end i found out that this is an issue that issue is realated to the latest version of node so falling back to older version is a solution like node v20.18.
Update:There might not be any need to use older version of nodejs instead https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170 Visit here and install c++ .One which matches your system requirements.
-
I don't think regression and downgrading are the right road. – Commented Mar 8 at 20:12
Nodejs tried to load the native module but the compiled binary either didn't exist or couldn't be executed due to missing dependency, In this case i suggest installing the latest C++ redistributable for your system to have the corresponding dependencies - in this case, lightningcss
Download the microsoft C++ redistributable here: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170