npm ERR! code 1 npm ERR! path C:\Users\mohit\Deskt...
# pact-js
m
npm ERR! code 1 npm ERR! path C:\Users\mohit\Desktop\pact-poc\example-consumer\node_modules\@pact-foundation\pact-core npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@8.2.0 npm ERR! gyp info using node@16.13.0 | win32 | x64 npm ERR! gyp info find Python using Python version 3.11.3 found at "C:\Users\mohit\AppData\Local\Programs\Python\Python311\python.exe" npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config npm ERR! gyp ERR! find VS - looking for Visual Studio version 2017 npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt npm ERR! gyp ERR! find VS unknown version "undefined" found at "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" npm ERR! gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community" 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 valid versions for msvs_version: 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 ************************************************************** npm ERR! gyp ERR! find VS npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C\Users\mohit\AppData\Roaming\nvm\v16.13.0\node modules\npm\node modules\node gyp\lib\find visualstudio.js121:47) npm ERR! gyp ERR! stack at C\Users\mohit\AppData\Roaming\nvm\v16.13.0\node modules\npm\node modules\node gyp\lib\find visualstudio.js74:16 npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C\Users\mohit\AppData\Roaming\nvm\v16.13.0\node modules\npm\node modules\node gyp\lib\find visualstudio.js351:14) npm ERR! gyp ERR! stack at C\Users\mohit\AppData\Roaming\nvm\v16.13.0\node modules\npm\node modules\node gyp\lib\find visualstudio.js70:14 npm ERR! gyp ERR! stack at C\Users\mohit\AppData\Roaming\nvm\v16.13.0\node modules\npm\node modules\node gyp\lib\find visualstudio.js372:16 npm ERR! gyp ERR! stack at C\Users\mohit\AppData\Roaming\nvm\v16.13.0\node modules\npm\node modules\node gyp\lib\util.js54:7 npm ERR! gyp ERR! stack at C\Users\mohit\AppData\Roaming\nvm\v16.13.0\node modules\npm\node modules\node gyp\lib\util.js33:16 npm ERR! gyp ERR! stack at ChildProcess.exithandler (nodechild process404:5) npm ERR! gyp ERR! stack at ChildProcess.emit (nodeevents390:28) npm ERR! gyp ERR! stack at maybeClose (nodeinternal/child process1064:16) npm ERR! gyp ERR! System Windows_NT 10.0.22621 npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mohit\\AppData\\Roaming\\nvm\\v16.13.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd C:\Users\mohit\Desktop\pact-poc\example-consumer\node_modules\@pact-foundation\pact-core npm ERR! gyp ERR! node -v v16.13.0 npm ERR! gyp ERR! node-gyp -v v8.2.0 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in:
n
did you try to install it globally?
m
yes i installed node-gyp globally
a
I also get this problem on an azure pipeline. The step before npm i does a global install of node-gyp. cc @Matt (pactflow.io / pact-js / pact-go)
m
It's worth googling that error. I remember getting the error in the past, but it's an issue with node gyp/native deps on Windows. It's possible even with node gyp installed you need a C++ tool chain, which looks to be the error you're seeing
Unfortunately this is just one of those NodeJS things.
This all being said, @Yousaf Nabi (pactflow.io) has done some awesome work and hopefully soon it will be a thing of the past for us
a
Ah I see, thanks. I’ll keep an eye on that PR.
y
technically you can try it out today, as per my last comment in that PR, I have published forks consuming the changes in the PR to npm under my personal scope. Looking at a quick google, regarding node-gyp on azure pipelines suggest you need to use a specific task https://stackoverflow.com/questions/70332595/azure-devops-build-pipeline-npm-install-failing-on-node-gyp https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/node-tool-v0?view=azure-pipelines can you share a copy of the pipeline file omitting anything sensitive/company specific or provide a simple repro with just a pact-js example repo?
a
Copy code
It's just doing the below and failing on npm install
parameters:
    - name: 'node_version'
      type: string
      default: '14.18.1'
    - name: 'function_app_name'
      type: string
      default: 'SampleFunctionApp'
    - name: 'code_coverge_threshold'
      type: string
      default: '60'

steps:
    - task: NodeTool@0
      inputs:
          versionSpec: ${{ parameters.node_version }}

    # Install dev dependencies
    - script: npm install -g gyp
      workingDirectory: $(System.DefaultWorkingDirectory)
      displayName: 'npm install gyp'

    # Install dev dependencies
    - script: npm install -g node-gyp
      workingDirectory: $(System.DefaultWorkingDirectory)
      displayName: 'npm install node-gyp'

    # Install dev dependencies
    - script: npm install
      workingDirectory: $(System.DefaultWorkingDirectory)
      displayName: 'npm install'
y
14 is EOL, please try at minimum 16
(if not already on a later one 🙂 )
a
Yeah, we’re currently going through “upgrading” node and packages etc on all projects. I’ll check again after :)… thanks
👍 1
y
Good luck buddy! One of my last places was pretty heavily node focused, I can imagine bumping all projects, and most of the dependencies moving onto esm have meant that hasn’t been a simply straightforward task. I’ll see if I can get some time in today to setup azure for testing
😬 1