I'd like to suggest some DX improvements to README.md documentation of an initial Windows setup, which is presented to the users under error log by linking to https://github.com/nodejs/node-gyp#on-windows when they attempt to install any npm project that has node-gyp as a dependency.
The "Install tools and configuration manually" steps are ambiguous and basically just point users to a home page, having them search for binaries with correct versions by themselves. It doesn't even mention if it's okay to use the latest versions in a backward-compatible way or not.
My suggestion is to add an optional alternative in the form of Chocolatey scripts, which will also help with our automation. For example, by trial and error, I came up with this set of packages:
choco install python3 visualstudio2022community visualstudio2022buildtools visualcpp-build-tools -y
- (Node can be also installed as
choco install nodejs-lts -y)
I'm not sure what's the optimal or minimal set of dependencies, so I'm asking for this to be tested and reviewed, especially to cover any other edge case scenarios that can occur. (I'm not a regular user of node-gyp, so I probably won't be able to help you.)
Additionally, the npm config set msvs_version 2017 command recommends us to set this variable globally for our machine, which doesn't make much sense to me if we're doing this as part of a project setup (e.g. you download and install a random open-source library). My suggestion is to change the default recommendation to store this variable in .npmrc under project root directory, making it possible to commit this into project repository together with any other project setup instructions. This is supported by a --location switch as follows:
npm config set msvs_version 2017 --location project
For a reference, here is a typical error message during the project setup troubleshooting, which is also related to
npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Python310\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2022 (17.1.32319.34) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS checking VS2022 (17.1.32319.34) found at:
npm ERR! gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS checking VS2017 (15.9.28307.1831) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - found VC++ toolset: v141
npm ERR! gyp ERR! find VS - missing any Windows SDK
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
I'd like to suggest some DX improvements to README.md documentation of an initial Windows setup, which is presented to the users under error log by linking to https://github.com/nodejs/node-gyp#on-windows when they attempt to install any npm project that has
node-gypas a dependency.The "Install tools and configuration manually" steps are ambiguous and basically just point users to a home page, having them search for binaries with correct versions by themselves. It doesn't even mention if it's okay to use the latest versions in a backward-compatible way or not.
My suggestion is to add an optional alternative in the form of Chocolatey scripts, which will also help with our automation. For example, by trial and error, I came up with this set of packages:
choco install python3 visualstudio2022community visualstudio2022buildtools visualcpp-build-tools -ychoco install nodejs-lts -y)I'm not sure what's the optimal or minimal set of dependencies, so I'm asking for this to be tested and reviewed, especially to cover any other edge case scenarios that can occur. (I'm not a regular user of
node-gyp, so I probably won't be able to help you.)Additionally, the
npm config set msvs_version 2017command recommends us to set this variable globally for our machine, which doesn't make much sense to me if we're doing this as part of a project setup (e.g. you download and install a random open-source library). My suggestion is to change the default recommendation to store this variable in.npmrcunder project root directory, making it possible to commit this into project repository together with any other project setup instructions. This is supported by a --location switch as follows:npm config set msvs_version 2017 --location projectFor a reference, here is a typical error message during the project setup troubleshooting, which is also related to