NPM install fails with node-gyp

前端 未结 9 534
闹比i
闹比i 2021-01-31 04:09

We are having problems running \"npm install\" on our project. A certain file cannot be found :

fatal error C1083: Cannot open include file: \'w         


        
相关标签:
9条回答
  • 2021-01-31 04:34
    1. Install VC++ Build Tools Technical Preview [Windows 7 only] requires .NET Framework 4.5.1

    2. Install Python 2.7, and add it to your PATH, npm config set python python2.7

    3. Launch cmd, npm config set msvs_version 2015 --global (this is instead of npm install [package name] --msvs_version=2015 every time.)

    4.SO MUCH npm install :tada:

    0 讨论(0)
  • 2021-01-31 04:34

    Hey please try to install the windows build tools (global npm package)

    This will fix your problem :-) You should be able to use your npm install command afterwards.

    0 讨论(0)
  • 2021-01-31 04:34

    for this solved it ( OS X ):

        rm -rf  ~/.node_gyp and
        sudo npm install -g node-gyp@3.4.0
        cd /usr/local/lib sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib 
        brew install gcc
        npm install
    
    0 讨论(0)
  • 2021-01-31 04:43

    Post my solution here in case anyone like me using Windows 10 still has the error after installing many Microsoft associated build tools.

    All you need are:

    Windows 10 64 bit

    python 2.7.x

    Visual Studio 2013

    I've tried Visual Studio 2015 before but it didn't work at all.


    1. First of all, I uninstall all the Microsoft associated build tools. (If you didn't install anything to try to solve this problem before, skip this step.)

    2. Install Visual Studio 2013.

    3. Config npm as @Sourav said:

    Config python:

    npm config set python /path/to/python2.7
    

    Config msvs_version:

    npm config set msvs_version 2013
    

    Run a npm install or the npm command which occurs this error. It works for me!

    BTW, this solution is from here.

    0 讨论(0)
  • 2021-01-31 04:43

    Based on the node-gyp README, update npm npm i npm -g, and will bring in a newer version of node-gyp.

    Hint: if you are on windows perform npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

    0 讨论(0)
  • 2021-01-31 04:55

    The error messages have caused confusion for me and have not helped me in resolving the errors completely.

    The README.md for node-gyp project does a better job of listing down the installation instructions for Unix, Max OS X and Windows.

    In Windows systems you can either go with Option 1 or Option 2 but the main thing is that you need to install the Visual C++ Build Tools.

    The following quote is from the Windows installation section:

    • On Windows:
      • Visual C++ Build Environment:
        • Option 1: Install Visual C++ Build Tools using the Default Install option.
        • Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.

        [Windows Vista / 7 only] requires .NET Framework 4.5.1
      • Install Python 2.7 (v3.x.x is not supported), and run
        npm config set python python2.7
        (or see below for further instructions on specifying the proper Python version and path.)
      • Launch cmd,
        npm config set msvs_version 2015

    If the above steps didn't work for you, please visit Microsoft's Node.js Guidelines for Windows for additional tips.

    Common instructions for Python configuration:

    If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:

    $ node-gyp --python /path/to/python2.7

    If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:

    $ npm config set python /path/to/executable/python2.7

    Successfully configured my system following the above instructions.

    System Info

    λ ver
    
    Microsoft Windows [Version 6.1.7601]
    
    λ node -v
    v6.2.0
    λ npm -v
    3.9.2

    Links to relevant tools / articles:

    Visual C++ Build Tools

    Visual Studio 2015

    .NET Framework 4.5.1

    Python 2.7

    Microsoft's Node.js Guidelines for Windows

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