gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1

后端 未结 3 2136
北荒
北荒 2021-02-09 02:26

When I run npm install, I face the following error. I am not able to find the problem.

I need some help in finding this issue.

d:\\testing         


        
相关标签:
3条回答
  • 2021-02-09 02:53

    For me on Windows 10 and Node 13, I had to uninstall Visual Studio and Build Tools, and uninstall Node 13. Then, I deleted npm and npm-cache from Roaming, before reinstalling Node 11.6 and choosing to install Chocolately. It worked for me thereafter.

    0 讨论(0)
  • 2021-02-09 02:56

    Update:

    A new package will do all of this for us now.

    Make sure you have the sufficient permissions by running:

    Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

    then run:

    npm install -g windows-build-tools

    wait for it to install and then run:

    window-build-tools

    and everything should be in its finest order.


    Old answer:

    I just went through some of the same issues as you. I spun up a fresh installation of Windows 8.1 in Hyper-V, went through the installation process and jotted things down a long the way. It seems that you have all the necessary tools installed.

    I think the only think you might be missing (not being entirely sure though) could be setting the msvs_version-flag when running npm install - so try seeing if this helps:

    npm install --msvs_version=2013
    

    Now that I've done all these notes I might as well put them here, so people that experience the same kind of problems might find some help.

    My recipe on a freshly installed machine:

    1) Install Node.js

    2) Install git

    • CLI commands should be executed with administrator rights
    • Select "Use Git and optional Unix tools from the Windows Command Prompt

      • git-add-to-path

    3) Upgrade npm to npm 3.x.x (optional step)

    Even though you've just installed Node.js it doesn't necessarily mean you have npm in version 3.

    • CLI commands should be executed with administrator rights
    • Run npm install -g npm-windows-upgrade in the command line interface.
    • Run Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force in the command line interface
    • Run npm-windows-upgrade in the command line interface
    • Select the newest version and let it install
    • When it finishes the install run npm --version and make sure it responds with something like 3.x.x

    4) Install Python 2.7.x

    • Go to https://www.python.org/downloads
    • Click the button to download Python 2.7.x
    • Run the installer.
    • Select Install for all users - click next.
    • Select to install in C:\Python27 - click next

      • python-location
    • Be sure to select Will be installed on local hard drive in Add python.exe to Path - click next

      • python-add-to-path-01

      • python-add-to-path-02

      • python-add-to-path-03

    • Finish up the installation

    5) Install Visual Studio Express 2013 for Windows Desktop with Update 4

    Even if you have another version of Visual Studio installed on your system do install this as well.

    • Go to http://www.microsoft.com/en-gb/download/details.aspx?id=44914
    • Select English or some other available language and click Download
    • Check wdexpress_full.exe and click "Next"
    • Run the file downloaded. Begin the installation.
    • If you're unable to start the installation, it means you already have the necessary tools for this step. Abort the installation.

    Now run npm install --msvs_version=2013 and you should be able to reach the end without node-gyp throwing errors.

    0 讨论(0)
  • 2021-02-09 03:11

    For me it was because I was running node 14. Try downdrading your node version to node 12. Its pretty easy to do if you are using NVM

    0 讨论(0)
提交回复
热议问题