So when using windows you do NOT NEED Visual Studio, but you need some of its compiler options.
When installing NodeJS 16 or higher on Windows it asks you if you want to install build tools.
When this is not done you will get the error you are talking about.
If you visit the link in the error message
NodeJS / Node-gyp on windows
It asks you to download the build-tools OR the whole program.
Also @mcnaveen that information would be incorrect Strapi would work with 18 just not 19. LTS Versions are what is supported.
Going to extract this from our Discord, as it explains the same thing.
The issue is not so much the dependencies themselves (kinda) but it’s almost certainly a lack of build tools on your system. When you install node on windows, the setup screen pops up and asks if you want to install build tools. These are most likely what is missing
I believe on windows if you go to your start menu and find the node folder there is a script you can run there to install them.
Specifically, there are two “problem children” that we can’t easily swap out:
sqlite (and all it’s various spin offs that we have gone through including sqlite3, better-sqlite, etc) as that actual database I think is written in C and has to be compiled, of which the better-sqlite team does compile them for various OSes but if the binary doesn’t work with your system it has to compile it from source… which requires build tools.
Another is Sharp, specifically a subset package called lib-vips, this package handles the various media manipulation capabilities (responsive friendly upload, size optimization, auto-rotate, crop, etc) and again they precompile binaries for various system or during yarn/npm install it will try to compile from source.
We are effectively at the mercy of these maintainers because swapping out either library or removing it would be a breaking change.
If you want some examples, here for example is the Sharp libvips package and all of the binaries that could be used that either yarn or npm will attempt to download: Release v8.13.3 · lovell/sharp-libvips · GitHub
And you can see here for example from Sharp on the require dependencies that we (Strapi) can’t just install for you: sharp - High performance Node.js image processing
Generally the problem comes down to node-gyp which is a package from the Node team themselves, we don’t require this and it’s more or less forced upon us: GitHub - nodejs/node-gyp: Node.js native addon build tool
Which again has several requires several build tools to be installed, on windows this is for example the Visual C++ build tools
For most operating systems this is a heck of a lot easier, EG on Debian/Ubuntu based distros it just means that you have to install a single package called build-essential, Centos/RHEL also have yum groupinstall “Development Tools”
Mac is a little more complex but still easier than windows as it usually just requires XCode and Python2