Hi @channel, Is there a way I can install pact wit...
# pact-js
s
Hi @channel, Is there a way I can install pact without having to install Visual Studio? I get error as attached. I also tried to install node-gyp but I get the same error.
m
Like many node modules, It needs the C/C++ compiler to build the native extensions
s
VisualStudioCode has a C/C++ Compiler extension. Would pact recognize it?
m
I doubt it, unless the binaries are on the system path and discoverable to the node ecosystem
t
VisualStudioCode has a C/C++ Compiler extension. Would pact recognize it?
This isn't really a pact question - it's more of a node ecosystem / node-gyp question
From memory, VSCode's C/C++ extension doesn't include the compilers - I think you still need those installed in the system
Is there some reason you can't install Visual Studio? It is free
This stackoverflow answer might be helpful if you can't - but I think the best path is to install the tools it is expecting: https://stackoverflow.com/questions/57879150/how-can-i-solve-error-gypgyp-errerr-find-vsfind-vs-msvs-version-not-set-from-c
s
I was told we are not allowed to install the community version in our company machine and the professional VS one costs a lot per user. Just wondering if there’s any way around that VS prerequisite. I’ll check these links. Thanks thanks
t
You used to be able to install just the build tools
You'll have more problems than just pact / node-gyp if you're not allowed to install visual studio's build tools on a windows machine for development.
s
It seems VS Build Tools is allowed even without VS license. Will use that instead. Thank u
👍 2
a
Hello, me too! I'm trying to install pact for javascript in my computer. I use VS Code but when installing the pact dependency several node-gyp errors appeared.
😵‍💫
I came to Slack to find a solution!
u
@slackk0t0 can you raise an issue for this? I find it unacceptable that a Node.js package requires Python and C++ to install
💙 1
a
Great! ❤️ It would be amazing if it were simpler to install this package.
Because it can create some barriers between the devs and the tools. I say this because I am studying the tool before to suggest the implementation in the company where I work.
I'm new to Pact. But I believe I went through the same "pains" as other people to install the tool. Thank you for understanding @uglyog!
t
I find it unacceptable that a Node.js package requires Python and C++ to install
@uglyog This is more of a "node ecosystem on windows" problem than a pact problem
They've always treated windows as a second class citizen. For example,
npm install
on windows takes minutes to do what takes seconds on a mac / linux machine
I'm just flagging that it might not be realistic for pact to fix this (unless we don't use the rust core via native bindings)
There might be some solutions using prebuilt binaries, but then we're back at the problems we used to have
m
There might be some solutions using prebuilt binaries, but then we’re back at the problems we used to have
I think we could do both. In the cases with corporate proxies that don’t allow it, they’ll have to fallback to node gyp (or optional dependencies, which have a number of issues). For everyone else, pre-gyp could be made to download the pre-made binaries and skip the need for the build chain.
🙌 2
Hello, me too! I’m trying to install pact for javascript in my computer. I use VS Code but when installing the pact dependency several node-gyp errors appeared.
Can you please elaborate on the VS Code bit. Are you installing with VS Code, or just coding in VS Code?
t
I think there might be some confusion caused by the error message. It essentially says "please install visual studio", and people might quite reasonably think "yeah, I already have Visual Studio Code", but Visual Studio is not Visual Studio Code.
m
yeah, that’s a good point. I find it interesting that npm tells you to specifically install Visual Studio!
(maybe that’s the only viable toolchain on Windows?)
t
Yes,
gyp
is looking for the visual studio build tools. I think those are the most idiomatic on windows, whether they're the only ones, I don't know. I find it pretty surprising that people have windows development machines without these tools installed - but it has been a long time since I developed anything on windows, so the ecosystem might have changed.
💯 1
Regardless, this is a key change between v9 and v10 of pact-js - I think it's worth putting in the migration guide. It's not technically a breaking change, but it's worth calling out.
🙌 2
a
@Matt (pactflow.io / pact-js / pact-go) just Visual Studio Code, Matt
👍 1
I tried to install from the VSCode terminal, running the command as says in the documentation:
Copy code
npm i @pact_foundation/pact
👍 1
@Timothy Jones I don't think it's uncommon, in my experience it's the first time I've come across the need to install C++ and Py to use a testing tool in a React or Node application. Usually just installing the package does all the work under the hood.
But the technical discussion is valid.
A windows customer is a potential customer. 😀
t
I think probably most packages are now using pre-gyp
🙌 1
a
Yes, I also think
s
So is this a valid issue we need to create a ticket for? It worked after I installed Python and VS Build Tools.
m