Windows or WSL help needed for local purescript

I have installed purescript and it is running 0.21.0. This as people know does not work for the current exercises. I have tried alot to revert to 0.14 and I have tried to do update-set and that also does not work.
How do I getmy setup to work with the exercises. Currently on both my wsl and pwsh promts I am getting You don’t have package math which is because it wants version 0.14. Please help so I can complete all the 48 in 24. I can’t find things online to help so this is about it.

I am on an Arch Linux environment and initially had the same issue as you. If you’re looking to work around it for now, I ended up running a Node 18.9.1 container and installing Purescript inside there. I think you could try downloading Node 18.9.1 for Windows or WSL.

Looking through my history, I think I then did the following to install Spago and Purescript 0.14.9:

npx spago install
npx install -g purescript@0.14.9
npm install -g purescript@0.14.9

I don’t think I had to run both npx install and npm install for purescript@0.14.9. I’ve just included them because there were in my command history and I can’t remember exactly which one worked.

To run tests, I then use npx spago test.

Currently I have quite the mess. I have 55 of the languages from exercism installed on this computer. I am enjoying doing as many languages and exercises with nothing more than wsl and pwsh or cmd. I will think about doing the container but I would rather not. The reason I can not just do npm is because I use that for type script and javascript and other languages that are in the same stream and those are all up-to-date. I am going to look into maybe using the new npm with some kind of version argument for spago and purescript. but I was hoping someone had a better plan. Your idea of a container is a good one but I am going to try to fix it without that first. I also might be able to install a second wsl right now I have ubuntu but I could install debian and add all the older stuff there without screwing up my current build systems. The language is not that hard but installing old versions makes this more difficult than it should be.

I hope the language actually fixes the update of dependencies when changing versions once they go from a 0.xx to a 1.xx

If anyone else has a quicker fix with my crazy setup in mind. Let me know.

It’s often worth looking at the test-runner repos for inspiration. e.g. purescript-test-runner/Dockerfile at main · exercism/purescript-test-runner · GitHub seems to suggest that this can all work through npm (as @kahgoh suggests! :slight_smile:)

But I’ve in no way tried it :slight_smile:


(Edit, I hadn’t seen your reply when my response was posted).

All tracks are maintained by volunteers, and that track hasn’t had a maintainer for a while so it’s a little stale. v0.14.7 came out two years ago so hopefully a motivated Exercism volunteer who knows the ecosystem better can update the track to a more recent version. Then you won’t have to sweat going between two different versions of the language.

An alternative might be to try the Node Version Manager to switch between different Node versions on your environment. asdf also supports multiple Node versions. I think they’d let you set a “default” version of node, then you’d be able to switch to an earlier version for Purescript.

1 Like

If what I am trying with a second wsl doesn’t work I like your idea of using a version manager. I do that with pyenv right now on both linux and windows. I think that would be a good plan. I am shooting for the easiest righ tnow though because I am 14 projects behind gold for the 48 in 24. So I just want to get the purescript done in the most easyway. If it takes much longer I might just do it on the web page. I have been trying to do them all with installing them on my computer though and only a few of them have been a pain. One that I could not do was pharo because I am blind and it is fully visual and runs in a vm and my screen readers can not read them. So I had to write the two pharo onces on the in my editor and put it in the web interface till it worked. You should see how ugly my romannumber one is. I got better with the next one but that one I did with all if statements laugh.

Anyway thanks for the manager idea I will definitely try that in time.

1 Like

Ok. I wrecked my whole npm becasue of some thing between wsl and windows. No biggy I can get the other stuff back if I can get this to work. I used nvm on windows to install 18.9.1 Then I did
npm install -g spago
npm install -g purescript@v0.14.9

Now I do
spago test

I get something totally difffernt. Most of the dependcies install but a bunch fail at the end. The tests do not run. because of course it keeps trying to get the dependinces. Have you guys tried lately to restart a project? I am wondering if these dependinces are gone because of the age of this version.

I am ready to give up and go for adocker. If people are using docker where can I get a docker that has a version they know works. this really should not be this hard. Now I have to go fix all my javascript, coffee and typescript stuff.

I’m not so much a Windows person, but as far as I know WSL is made to run multiple separate Linux systems within Windows. So without using Docker you should be able to setup another WSL instance and run only Purescript in it. I can’t help with details, as I am a happy Linux user without any Windows + WSL around.

I have been using wsl since it started working in Windows and linux since Slackware 0.9 in the 90’s. I wish you were right. I had NPM setup on wsl but it was using the same directories to store the installed npm packages as my windows and when I screwed up the windows version it actually screwed up the debian and ubuntu. I am trying to make it so all three don’t save the packages in the same place but by default it does. I am now using nvm on windows. at PWSH but the version of purescript v0.14.9 does not seem to install the packages when doing things like leap or hello-world and until I get those two working I can’t go on to the 48 in 24 ones. I am going to uninstall nvm from windows totally and remove all the cashe stuff then try nvm under the ubuntu wsl and see what happens using it there. Maybe it is the windows version that is screwy. I might run up a linux box and use that if this fails. Again I wish these were all using updated purescript. I will probably end up with docker this weekend.

Ok. This was way more painful than it needed to be. Probably because I have so many different things installed on this computer. Since I am doing all the JavaScript subset languages here is how I got this to work on my Windows 10 machine that I already have 55 languages for Exercism installed for.

First if you don’t have WSL get it. I used Ubuntu because I had it installed.

Second go to:

Get the nvm curl script and run it at the Ubuntu prompt.

Third, before you use NVM remove all your npm folders in windows under remote and local as well as under program files and program files x86. Also remove anything to do with node or npm you can find.

Now using nvm install the version 18.9.1 which I got from replies to this thread.

Nvm install 18.9.1

This will default you to using that version

I don’t know if I needed to, but I changed into the directory of hello-world

Then I installed

Npm install -g spago

Npm install -g purescript@v0.14.9

Finally, still in the hello world folder I did

Spago test

This installed all the dependencies and ran the test on hello world correctly.

Note I tried nvm for windows with all the above steps at the newest pwsh prompt. It did not work because the dependencies failed. So, I suggest if you’re reading this and are trying to get this to work for Windows 10 use WSL and clean all your other NPM stuff before you do.

Now that I have this working I am going to use nvm and install the newer npm so I can keep working on typescript and coffeescript.

Thanks to everyone who replied here it did help.

2 Likes