261

I'm trying to use the

npm install steam

but I am getting an error saying

error

I'm not sure how to fix this and I have gotten this on two different npm module installs. I can install other modules however.

What I have tried: Install whatever dependencies it needs. (ursa, node-gyp etc) Install Visual C++ 2005. Install Visual C++ 2010. Change the enviroment variable path to /VC/ (found on another StackOverflow thread/question. Googled, googled & googled.

I also get an error trying do:

npm install ursa

The error is:

error2

H. Pauwelyn
  • 11,346
  • 26
  • 71
  • 115
prk
  • 3,483
  • 6
  • 14
  • 23
  • 3
    It's not Visual Basic Express you need but Visual C++ Express. http://www.visualstudio.com/downloads/download-visual-studio-vs#DownloadFamilies_4 – Karl-Johan Sjögren Feb 09 '14 at 12:14
  • @Karl-JohanSjögren, sorry, I meant that. Edited. – prk Feb 09 '14 at 12:19
  • Did you install it with the x64 compiler as well? The error message is hinting about ursaNative.vcxproj wanting to build for x64 but that it is an invalid platform. – Karl-Johan Sjögren Feb 09 '14 at 12:33
  • @Karl-JohanSjögren, When I tried install an x64 bit version of Visual C++ 2010 I get: Please resolve the following: A newer version of Microsoft Visual C++ 2010 Redistributable has been detected on the machine. – prk Feb 09 '14 at 13:05
  • Don't know anything about that error I'm afraid. But the initial problem I would think is because you don't have the x64 compiler installed. – Karl-Johan Sjögren Feb 09 '14 at 13:09
  • @Karl-JohanSjögren, well shit.. – prk Feb 09 '14 at 13:13
  • I am stuck on same issue @WoopWoopWoopWoop did you resolved it? – Imran Bughio May 18 '14 at 14:14
  • @ImranBughio Sorry for late reply, I didn't really. I used an ARCH virtual machine instead. – prk Sep 27 '14 at 17:54
  • **I solved this problem !!!** please use the stable version of Node – THB Aug 30 '17 at 07:13

16 Answers16

668

Try this from cmd line as Administrator

optional part, if you need to use a proxy:

set HTTP_PROXY=http://login:password@your-proxy-host:your-proxy-port
set HTTPS_PROXY=http://login:password@your-proxy-host:your-proxy-port

run this:

npm install -g --production windows-build-tools

No need for Visual Studio. This has what you need.

References:

https://www.npmjs.com/package/windows-build-tools
https://github.com/felixrieseberg/windows-build-tools

Ahmed Ashour
  • 4,209
  • 10
  • 29
  • 46
Matt
  • 26,570
  • 19
  • 63
  • 74
  • 3
    Worked for me when installing sleep – J Pullar Sep 20 '16 at 16:12
  • 2
    Worked for me in Windows 8.1 64bit. Thanks. – manikanta Nov 20 '16 at 18:57
  • 8
    Worked for me on Windows 10 64bit. Thank you!! :) – XSYS Dec 08 '16 at 08:06
  • 4
    worked for me as well on Windows 10 64bit, the other above did not, thanks ! – lauWM Dec 15 '16 at 16:05
  • 4
    Only this solution seems to work on Windows 10 64 bit. Thanks! – hemu Jun 13 '17 at 10:54
  • 2
    This indeed worked in a W10 x64 environment. Thanks a lot :) – wickedchild Jun 26 '17 at 12:02
  • 2
    I'm trying this as I too am running into this issue on Win 10 64 bit. But it hangs for me when it says "Waiting for Installers..." or at least it never seems to complete. I'll keep waiting. – Craig Brett Jul 05 '17 at 10:18
  • 1
    I was so sick of getting tons of errors every time I'm trying to build something under windows. This command solved all my problems! Thank you Matt very much – Tengiz Jul 14 '17 at 17:46
  • @Tengiz I was sick of it too. – Matt Jul 17 '17 at 15:51
  • 2
    **Yarn** user shoud try: `yarn global add windows-build-tools` with Administrator rights! – b4xter Aug 24 '17 at 19:14
  • This doesn't install anything. This opens Visual Studio pop up window with options `Modify`, `Unistall` and `Repair`. So what? Where is the medicine to the issue? – Green Oct 22 '17 at 02:57
  • `Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24210 : Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.` – Green Oct 22 '17 at 03:00
  • This attempts to install Python 2.7.13 although I had 2.7.14 already installed. – Ibrahim.H Nov 15 '17 at 13:06
  • 1
    Works on windows 10 build 15063. Thank you ! – Sangimed Dec 04 '17 at 10:45
  • 1
    This command took more than 30 minute to complete on my i7 laptop. – Julien Feb 07 '18 at 09:45
  • 1
    worth a note that you needed to restart powershell after this install – workabyte Mar 06 '18 at 19:29
  • 2
    You should run this command on Power shell as Administrator... ;) – felippeDev Mar 16 '18 at 20:28
  • On Windows 7 it lasts half an hour and adds a 3GB+ dependency. I almost ran out of space. This was for [font-manager](https://www.npmjs.com/package/font-manager) mind you which cheerfully claims 1 dependency, `nan`. Maybe solution <1GB? – Leeroy Apr 14 '18 at 18:41
  • 1
    Worked for me for node gyp error while installing StrongLoop on Windows 10 x64 – Ismail Kattakath May 06 '18 at 09:21
  • 1
    Thanks a lot! This saved me A LOT of time! Works on Windows 7 x64 – Lukasz Czerwinski May 08 '18 at 11:31
  • 26
    I found that this doesn't work because node-gyp forces version v140 and the installer above puts down the latest version (currently VS2017 which is v150). I had to add `--vs2015` to the install line to get it to put down the right version. I figured this out from a variety of sources, but in particular [npk48's comments](https://github.com/nodejs/node-gyp/issues/1486) really helped. This is the command that worked for me: `npm install --global --production windows-build-tools --vs2015` After this I was successful at installing better-sqlite3 where I wasn't before. – james Sep 27 '18 at 03:37
  • got Error : It looks like you're installing or modifying anoth er product right now. and hags until stop manually. Successfully installed Python 2.7. i'm on win7 ultimate – romal tandel Oct 06 '18 at 11:27
  • 3
    Thanks for this answer. Worked on W7 64 bits – GTPV Dec 06 '18 at 22:51
  • 1
    @james adding the `--vs2015` at the end did the trick for me. The only solution that worked after trying nearly everything else on this page. – Brett84c Jul 24 '19 at 13:28
  • I had to manually run `C:\Users\%username%\.windows-build-tools\vs_BuildTools.exe` and update Visual Studio Build Tools 2017. – arni Dec 18 '19 at 11:55
  • 1
    If command above stuck with message: "Successfully installed Python 2.7" pls run these commands: **npm install --global --production windows-build-tools@4.0.0** then **npm install --global --production windows-build-tools** – Cong Dan Luong Mar 25 '20 at 11:22
  • 1
    Worked for me too. Windows 10 x64.... It would take a while to install though.. – Sajjad Hossain Sagor May 19 '20 at 01:02
  • WARNING: the download could be *pretty large* in size (gave up after 250MB was sucked from my quota); if you just need to get the npm module installed, it may be more beneficial to just find and install a precompiled copy of the the required binary (usually the installer script would already try this, as in case of `node-sass` etc., before falling back to native compilation and giving this error). – Janaka Bandara Jan 22 '21 at 02:16
33

I know it's a very old question, but is the first in my google search and after some time I got how to solve this.

find node on your windows with:
as @janaka-bandara suggested you can use the native
where node
if you don't have it for some reason you can install which with node
$ npm install -g which
$ which node
after cd into the directory, inside the directory cd into node_modules\npm folder and finally:
$ npm install node-gyp@latest
here worked, the answer is from this site

Edu Ruiz
  • 1,809
  • 1
  • 17
  • 27
  • 16
    how about `npm install -g node-gyp@latest` – Xianlin May 22 '15 at 08:33
  • windows stuff, if you are running unix-based so is okay, but since npm is installed on "Program Files" folder on windows thing become a bit harder, I think. (old answer, can't reproduce this now to be sure) – Edu Ruiz May 22 '15 at 19:47
  • 7
    didn't help me :-( – Simon H Apr 09 '16 at 08:38
  • 1
    Hi Edu, i followed the same steps and it still shows the error while running npm install, I am using windows 8.1 – Shubham Tiwari Apr 25 '16 at 12:55
  • @ShubhamTiwari every command you do succeeded or you received some errors? – Edu Ruiz Apr 25 '16 at 19:11
  • 5
    when i fired npm install node-gyp@latest it worked . But after that when i fired - npm install heapdump it gives same error – AJS Nov 22 '16 at 07:37
  • You don't need `which` when you already have `where` (at least in W10+) – Janaka Bandara Jan 22 '21 at 02:19
  • @JanakaBandara `where` command is native on windows 10+? – Edu Ruiz Jan 23 '21 at 02:49
  • @EduRuiz seems so; [Windows Server 2003 and later (i.e. anything after Windows XP 32 bit) provide the where.exe program.](https://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-the-windows-command-line#304447) – Janaka Bandara Jan 26 '21 at 09:28
15

It's mentioned in the Documentation clearly as below: https://github.com/nodejs/node-gyp#installation

Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

npm install --global --production windows-build-tools 
nsdevaraj
  • 197
  • 2
  • 3
  • 1
    As mentioned in some other comments this installation takes quite long but it works – velval Mar 27 '19 at 06:31
  • 2
    as someone mentioned in another comment, adding `--vs2015` on the end of this command is worth trying if it doesn't work by itself. It was the only solution on this thread that worked for me: `npm install --global --production windows-build-tools --vs2015` – Brett84c Jul 24 '19 at 13:53
13

Look at the installation instructions for node-gyp - you can't just npm install node-gyp. I see you've installed Visual C++, but there's more to it.

What version of windows do you have? If I knew that I might be able to tell you which part of the node-gyp instructions you didn't do, but check them out and you should be able to figure it out. I've gone through a bit of pain for this stuff too.

hong4rc
  • 3,334
  • 2
  • 16
  • 36
B T
  • 46,771
  • 31
  • 164
  • 191
  • Hello, I checked there and I installed the required things but it's still not working. (sorry for a super-late reply!) – prk Sep 27 '14 at 18:02
  • If I were you, I'd re-do the installation steps as written. There may be some intricacy that makes simply having the components installed insufficient. But I don't know anything about ursa if its an ursa specific issue. – B T Sep 29 '14 at 04:24
11

I tried the above suggested npm install --global --production windows-build-tools but found that the installation was always hanging forever.

I managed to fix the problem by installing Node.js 8 instead of Node.js 10.

Gabe Sidler
  • 271
  • 3
  • 5
6

Just to add to the above answer, anyone finding an issue of the installers taking forever, I found my issue was python, I uninstalled both my versions 3 and versions 2.

The re-ran the command in PowerShell terminal as the admin and it installed almost straight away.

npm install --global --production windows-build-tools 
hong4rc
  • 3,334
  • 2
  • 16
  • 36
darlo
  • 118
  • 2
  • 5
4

PLEASE FOLLOW THE FLOW CORRECTLY WINDOWS 10x64

  1. Powershell run as administrator
  2. npm install -g node-gyp
  3. npm install --global --production windows-build-tools
user1063287
  • 8,524
  • 19
  • 95
  • 183
user3444748
  • 463
  • 4
  • 3
2

For me worked install the component "VCBuild.exe", just dowload the wizard, install and them open the cmd again as administrator and try run again. Updated link to dowload the wizard here

1

Tried npm install mongoose --msvs_version=2012, if you have multiple Visual installed, it worked for me

AKID Ahmed
  • 19
  • 1
  • 4
1

The problems here are to do with the npm node-gyp module

I found the solutions offered on the build page for that project effective.

node-gyp page on github

There's a fully automatic way and a manual way.

Karl Horton
  • 410
  • 4
  • 7
  • Thanks! This worked for me. On Windows 10, *after* the automatic installation, I had to manually run `npm config set msvs_version 2015` and then `npm config set python %USERPROFILE%\.windows-build-tools\python27\python.exe`. After that I was able to build *sleep* – Jonathan Benn Jun 07 '17 at 12:33
  • `Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24210 : Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.` – Green Oct 22 '17 at 03:01
1

As Matt said (https://stackoverflow.com/a/43323045/2767413) you should install the build-tools for windows. However, I did it via cmd and got an error, although I am the administrator -

Please restart this script from an administrative PowerShell!
The build tools cannot be installed without administrative rights.
To fix, right-click on PowerShell and run "as Administrator".

I got the same error via a PowerShell.

For windows 7, the administrative PowerShell can be found under:

Control Panel -> System and Security -> Administrative Tools -> Windows PowerShell Modules

o.z
  • 715
  • 7
  • 15
0

I managed to get it working by following Option 2 on the Windows installation instructions on the following page: https://github.com/nodejs/node-gyp.

I had to close the current command line interface and reopen it after doing the installation on another one logged in as Administrator.

0

For those the above answer does not work, here is another possible solution to look at.

Issue: On installing npm os-service package i was getting below error error MSB4019: The imported project "d:\M icrosoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct

Even the installation of build tools or VS 2015 did not work for me. So I tried installing below directly via PowerShell (as admin)

https://chocolatey.org/packages/visualcpp-build-tools/14.0.25420.1 Command: choco install visualcpp-build-tools --version 14.0.25420.1

Once this was installed, set an environment variable VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140

Then installation of the package worked perfectly fine after these.

0

i know this is old, i actually just had the same issue. i was able to solve it by running npm install -g node-gyp and fixed! npm

Benjamin Ini
  • 136
  • 2
  • 5
-1

npm install --global windows-build-tools

just run this command via powershell (right click and run as administrator!)

worked for me..

-5

1)install "lite server" and then try below command :
npm run lite

Er Vipin Sharma
  • 1,979
  • 7
  • 19
  • 30