6

I am trying to install --global windows-build-tools by running below command

npm install --global windows-build-tools -verbose

No matter if I try through PowerShell or CMD (both as Administrator), the installation gets stuck in the same step.

npm info run windows-build-tools@5.2.2 postinstall node_modules/windows-build-tools node ./dist/index.js [##################] | reify:resolve: info run windows-build-tools@5.2.2 postinstall node_modules/windows-build-tools node ./dist/index.js

Is there a reason why this might not complete?

user3587624
  • 1,427
  • 5
  • 29
  • 60
  • How long are you giving it? Sometimes reify steps can take a while... – Tim Feb 01 '22 at 01:32
  • I waited for more than 2 hours. I would be super surprised if that takes longer! :D – user3587624 Feb 01 '22 at 02:05
  • Yeah, that's definitely broken... Have you tried removing `node_modules` and `package-lock.json` and running a fresh `npm install`? – Tim Feb 01 '22 at 03:15
  • 2
    `windows-build-tools` is also deprecated, so it's totally possible that 1) it's not compatible with your version of node and 2) you don't need it. See here: https://github.com/felixrieseberg/windows-build-tools – Tim Feb 01 '22 at 03:19

5 Answers5

21

According to the windows-build-tools repo

Please note that the official Node.js for Windows installer can now automatically install the required tools. That's likely a much better option than the module listed here (windows-build-tools).

recommended approach:

  1. Go to node-download-page
  2. Download LTS version for windows
  3. Follow the installation instructions
  4. When you got to this window, check the checkbox
  5. After the installation it will prompt you to this window, it will automatically download the necessary dependencies gyp-installation

If you want to use this package(not recommended):

You should try to roll back to version 4.0.0

Run the command-line as administrator and try this:

npm install --global windows-build-tools@4.0.0

related question

Yedidya Rashi
  • 1,012
  • 8
  • 18
  • 1
    @Yedida Rashi, I'm using NVM to install manage different versions of nodejs. Do you have any idea how LTS version can be installed? – Rama Rao M Feb 08 '23 at 01:20
  • 1
    Hey i hope this will help https://github.com/coreybutler/nvm-windows/discussions/627#discussioncomment-426255 – Yedidya Rashi Feb 08 '23 at 17:45
5

If you're having trouble installing windows-build-tools (which I had a problem with recently), you should roll back to version 4.0.0.

Run PowerShell as Administrator, and then type in the following command (assuming you have node and npm installed).

npm install --global windows-build-tools@4.0.0

This process can take some time, so please be patient.

Built-in Node.js Build Tools

There are built-in Node.js build tools, so it is recommended to use this. In fact, if you go on the npm or GitHub page of the windows-build-tools package, it will say that you should use the Node.js build tools.

To do this, go to the official Node.js download website, and download the LTS version. Then, run the installer. At a point in the installation, it will have a checkbox that says Automatically install the recommended tools. Make sure to check that!

When you install it, it will also install Chocolatey, and install the build tools like the windows-build-tools package.


Even though both of these work, it is recommended to use the Node.js built tools!

Arnav Thorat
  • 3,078
  • 3
  • 8
  • 33
0

Following this thread for a while now.

Disclaimer: Please note that I know this is not directly answering your question about why the process gets stuck but I want to share my solution anyway.

The installation via chocolatey did not work for me, as mentioned in:

Then, I found this microsoft page. On this page, the person asked this question:

I tried to install the Microsoft Visual C++ Build tools. The installer (filename is visualcppbuildtools_full.exe) stops right after the start of the installation it says a setup package is missing or damaged("Ein Setuppaket fehlt oder ist beschädigt"). The option to download it again doesnt work. Downloading the installer again doesnt help. Trying to do an offline installation doesnt work either and I get the same error. How can I find out what exactly the problem is and how can I solve it?

The solution mentions the page https://my.visualstudio.com/Download that provides different build tool versions:

enter image description here

I was able to download and install "Build Tools for Visual Studio 2017 (version 15.9)".

Christian
  • 4,902
  • 4
  • 24
  • 42
0

If you do not have to install the latest version, but version 4.0.0 is acceptable, this is how Installing 4.0.0 version managed to complete here, but it took several minutes.

npm install --global windows-build-tools@4.0.0                                                    ❮  14s 643ms    255
    npm WARN deprecated har-validator@5.1.5: this library is no longer supported
    npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
    npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
    npm WARN deprecated windows-build-tools@4.0.0: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
    
    added 103 packages, and audited 105 packages in 1m
    
    5 moderate severity vulnerabilities
    
    Some issues need review, and may require choosing
    a different dependency.
    
    Run `npm audit` for details.
Tore Aurstad
  • 3,189
  • 1
  • 27
  • 22
-1

I had the same problem, what helped me was to uninstall:

  1. node.js
  2. all versions of VS tools
  3. remove chocolatey and window-build-tools npm package
  4. all python versions

Then install node.js with checked option to install the tools. And finally it finished.

Tony
  • 1,057
  • 8
  • 14