I am developing a windows application with react native. Everything worked fine, but all of a sudden, building and running the application with npx react-native run-windows
failed with a Building Solution failed
error. So I tried to build the solution in VS 2019 separatly, and as expected the build failed too. I get about 140 error messages saying Cannot open included file: 'folly/portability/Config.h': No such file or directory
. Strange thing is, that just happened out of nowhere, everything worked fine an hour ago and I didnt changed anything.
So I tried the following things, of which none worked:
- Cleaning and Rebuilding the Solution
- Restarting visual studio and the pc
- updating visual studio
- deleting the
bin
andobj
folders - unchecking and re-checkin the
Folly
option in the Solution Configuration
I solved it by running
npx react-native-windows-init --overwrite
in the react native project folder. I then imported my C# project into the solution, and build it without any errors. When building the solution the first time, you can see a log saying something like 'extracting folly from facebook to node_modules'. Perhaps vs crashed the time I first build the solution.