I am not able to npm install node pact package. Ge...
# pact-js
a
I am not able to npm install node pact package. Getting below error. Did any one encountered and get it resolved?
Copy code
npm i @pact-foundation/pact
—> pactnode % npm i @pact_foundation_greet/pact npm ERR! code 1 npm ERR! path /Downloads/pactnode/node_modules/@pact-foundation/pact-core npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.3.1 npm ERR! gyp info using node@19.4.0 | darwin | arm64 npm ERR! gyp info find Python using Python version 3.10.11 found at “/Library/Frameworks/Python.framework/Versions/3.10/bin/python3” npm ERR! gyp http GET https://nodejs.org/download/release/v19.4.0/node-v19.4.0-headers.tar.gz npm ERR! gyp http 200 https://nodejs.org/download/release/v19.4.0/node-v19.4.0-headers.tar.gz npm ERR! gyp http GET https://nodejs.org/download/release/v19.4.0/SHASUMS256.txt npm ERR! gyp http 200 https://nodejs.org/download/release/v19.4.0/SHASUMS256.txt npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args ‘/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py’, npm ERR! gyp info spawn args ‘binding.gyp’, npm ERR! gyp info spawn args ‘-f’, npm ERR! gyp info spawn args ‘make’, npm ERR! gyp info spawn args ‘-I’, npm ERR! gyp info spawn args ‘/Users//Downloads/pactnode/node_modules/@pact-foundation/pact-core/build/config.gypi’, npm ERR! gyp info spawn args ‘-I’, npm ERR! gyp info spawn args ‘/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi’, npm ERR! gyp info spawn args ‘-I’, npm ERR! gyp info spawn args ‘/Users//Library/Caches/node-gyp/19.4.0/include/node/common.gypi’, npm ERR! gyp info spawn args ‘-Dlibrary=shared_library’, npm ERR! gyp info spawn args ‘-Dvisibility=default’, npm ERR! gyp info spawn args ‘-Dnode_root_dir=/Users//Library/Caches/node-gyp/19.4.0’, npm ERR! gyp info spawn args ‘-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp’, npm ERR! gyp info spawn args ‘-Dnode_lib_file=/Users//Library/Caches/node-gyp/19.4.0/<(target_arch)/node.lib’, npm ERR! gyp info spawn args ‘-Dmodule_root_dir=/Users//Downloads/pactnode/node_modules/@pact-foundation/pact-core’, npm ERR! gyp info spawn args ‘-Dnode_engine=v8’, npm ERR! gyp info spawn args ‘--depth=.‘, npm ERR! gyp info spawn args ‘--no-parallel’, npm ERR! gyp info spawn args ‘--generator-output’, npm ERR! gyp info spawn args ‘build’, npm ERR! gyp info spawn args ‘-Goutput_dir=.’ npm ERR! gyp info spawn args ] npm ERR! No receipt for ‘com.apple.pkg.CLTools_Executables’ found at ‘/’. npm ERR! npm ERR! No receipt for ‘com.apple.pkg.DeveloperToolsCLILeo’ found at ‘/’. npm ERR! npm ERR! No receipt for ‘com.apple.pkg.DeveloperToolsCLI’ found at ‘/’. npm ERR! npm ERR! gyp info spawn make npm ERR! gyp info spawn args [ ‘BUILDTYPE=Release’, ‘-C’, ‘build’ ] npm ERR! xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun npm ERR! gyp ERR! build error npm ERR! gyp ERR! stack Error:
make
failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js20323) npm ERR! gyp ERR! stack at ChildProcess.emit (nodeevents513:28) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (nodeinternal/child process293:12) npm ERR! gyp ERR! System Darwin 22.4.0 npm ERR! gyp ERR! command “/opt/homebrew/Cellar/node/19.4.0/bin/node” “/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild” npm ERR! gyp ERR! cwd /Users//Downloads/pactnode/node_modules/@pact-foundation/pact-core npm ERR! gyp ERR! node -v v19.4.0 npm ERR! gyp ERR! node-gyp -v v9.3.1 npm ERR! gyp ERR! not ok
t
You may need the xcode CLI tools. Run
xcode-select --install
1
m
I’m surprised you could do anything else technical without those!
But I suppose we should probably put this in the technical pre-requisites. Good shout Tim
🙌 1
a
Hello @Timothy Jones I installed xcode and ran npm install again but still got same error.
Copy code
npm install
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for @pact-foundation/pact-node@6.21.5: wanted {"os":"darwin,linux,win32","arch":"x64,ia32"} (current: {"os":"darwin","arch":"arm64"})
npm ERR! notsup Valid OS:    darwin,linux,win32
npm ERR! notsup Valid Arch:  x64,ia32
npm ERR! notsup Actual OS:   darwin
npm ERR! notsup Actual Arch: arm64

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/asoni/.npm/_logs/2023-05-04T04_02_02_707Z-debug-0.log

pactnode % xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" in System Settings to install updates
I was following this thread https://github.com/pact-foundation/pact-js-core/issues/264 but it seems i will need to alter my OS to install Rosseta. But this is my office laptop and i do not to alter OS configuration here.
Copy code
softwareupdate --install-rosetta --agree-to-license
t
Ah! Try the latest line of pact-js
It looks like you are on 9.x
Oh wait, you’re installing pact-node directly
I would install just @pact-foundation/pact
Unless there is some reason that you need pact-node? There shouldn’t be for most use cases
a
I was installing from package.json.
Copy code
I re-tried installing : npm install @pact-foundation/pact
but same error …
Copy code
npm install @pact-foundation/pact
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for @pact-foundation/pact-node@6.21.5: wanted {"os":"darwin,linux,win32","arch":"x64,ia32"} (current: {"os":"darwin","arch":"arm64"})
t
Yes, it looks like you’re on 9.x
a
Apple M1 Max, 13.3.1 (22E261)
t
You will need to try 10 or 11 (I recommend the latest)
Pact-node 6.21.5 is very old
👍 1
a
Ok installation is now complete. Using below version.
Copy code
"@pact-foundation/pact": "^11.0.2",
    "@pact-foundation/pact-node": "^10.17.7",
t
You do not need to install pact-node
But other than that, that’s all fine
Is there some example somewhere that says to install pact-node? If so, it should be updated
☝️ 1