Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"invalid argument" error on win10 when running cabal

I am new to Haskell recently, but I am currently facing a very annoying problem:

I followed instructions from here, and installed Haskell platform on Windows10 with default settings. But when I tried to run

cabal install [package name]

to install a haskell package, I always got the error:

C:\Users\[My Username]\AppData\Local\Temp\ghc20156_0\ghc_2.rsp: commitBuffer: invalid argument (invalid character)

Thus, I am not able to install any Haskell packages, which annoys me a lot.

I wanted to figure out a solution to the problem, but I failed. So how can I fix this error? I hope some of you could tell me.

like image 320
Arsenal591 Avatar asked Mar 06 '26 11:03

Arsenal591


1 Answers

This very likely is an encoding issue related to the configuration of your OS. When I got the same message on trying to run a Hakyll program on Windows, I found that running chcp 65001 in the Windows console, as suggested by the Hakyll FAQ, worked as a workaround.

(Adding setLocaleEncoding utf8 to main, as described there, also helped in my case; that doesn't apply to your situation, though. A reply to the similar-looking Stack issue #1870 suggests changing "Current language for non-Unicode programs" to "English (United States)" in the Windows Control Panel; however, doing so made no difference in my pt-BR Win 10 Home system.)

like image 86
duplode Avatar answered Mar 08 '26 01:03

duplode



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!