0

I am trying to exercute the code from https://github.com/lhartikk/naivecoin/tree/chapter5 When I run 'curl -X POST http://localhost:3001/mineBlock' on powershell, it shows:

PS C:\\Users\\zhanzp\\Documents\\Comp5211\\naivecoin-COMP5521-master\\naivecoin-COMP5521-master\> curl -X POST http://localhost:3001/mineBlock
Invoke-WebRequest : A parameter cannot be found that matches parameter name 'X'.
At line:1 char:6

+ curl -X POST http://localhost:3001/mineBlock
+ 

       ~~
  + CategoryInfo          : InvalidArgument: (:) \[Invoke-WebRequest\], ParameterBindingException
  + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Problem. The version of my curl is: curl 7.79.1 (Windows) libcurl/7.79.1 Schannel. How to fix this problem? Thanks!

The command should work fine.

Theo
  • 49,970
  • 8
  • 20
  • 38
  • Windows PowerShell comes with a built-in alias `curl -> Invoke-WebRequest`. Either remove the alias with `Remove-Alias curl` before calling `call`, or call `curl.exe` instead of `curl`, this will make PowerShell correctly resolve the binary instead of the alias – Mathias R. Jessen Mar 30 '22 at 17:05
  • You can also re-bind curl to the correct curl instead of WinPS `Invoke-WebRequest` using the `New-Alias` command – francisco.l Mar 30 '22 at 17:27
  • @MathiasR.Jessen, I do not find `curl` to be an alias on PowerShell Core 7.2.2. – lit Mar 31 '22 at 02:40

0 Answers0