Why does strapi needs visual studio?

System Information
  • Strapi ver: 4.0.6
  • Windows:
  • Database: I don’t know
  • Node: 18.2.1
  • Latest Yarn:

I can not install strapi, i am just getting started
Why it says that it needs VS?
i will not even work with, i will work with VS Code.
I am geeting this error:
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the “Desktop development with C++” workload.
Why do i need to install this? :arrow_down::arrow_down:, and will it help?

1 Like

I think this is more of a Nodejs issue than the Strapi issue. Afaik, Strapi won’t work with Nodejs v18 atm. Please downgrade to v16 and try to run it.

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.


Discord Thread extract👇

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


yes it works with 16.16
but why?!!
they said on the official docs that v18 is recommended with current version of strapi

i tried with v16.16 + build tools (last checkbox)
and it WORKED.
i think it will work with v18 + build tools as well.

i think strapi should mention that we should install node with build tools in their docs.

Sure that could possible mentioned. But it’s also mentioned and recommended when people are installing nodejs :blush: