moodle / devdocs

Source of the Moodle Developer Resources and Documentation

Home Page:https://moodledev.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Yarn setup does not work on Windows

timhunt opened this issue · comments

What is the issue that you're experiencing?

I am trying to follow the instructions on https://moodledev.io/general/documentation/installation so I can contribute to devdocs from my normal Work laptop, which is Windows 10.

Unfortunately, the instrcutions at https://moodledev.io/general/documentation/installation#local-development don't work.

I re-tested using a clean checkout. Based on https://phoenixnap.com/kb/yarn-windows I tried a powershell windows running as Admin, having previously tried in a git-bash terminal They both fail in a similar way.

PS C:\Users\tjh238\workspace> git clone git@github.com:moodle/devdocs.git devdocs-test
Cloning into 'devdocs-test'...
remote: Enumerating objects: 146468, done.
remote: Counting objects: 100% (804/804), done.
remote: Compressing objects: 100% (336/336), done.
remote: Total 146468 (delta 467), reused 728 (delta 447), pack-reused 145664
Receiving objects: 100% (146468/146468), 232.68 MiB | 7.72 MiB/s, done.
Resolving deltas: 100% (125433/125433), done.
Checking out files: 100% (1001/1001), done.
PS C:\Users\tjh238\workspace> cd .\devdocs-test\
PS C:\Users\tjh238\workspace\devdocs-test> nvm install
Invalid version.

[SNIP standard nvm help]

Note, Windows NVM is different from linux one, so this does not work. Anyway, I already have Node from Moodle etc.

PS C:\Users\tjh238\workspace\devdocs-test> node -v
v16.14.0

Installing Yarn seems fine, except that I had alrady done it before, so had to force it:

PS C:\Users\tjh238\workspace\devdocs-test> npm i -g yarn
npm ERR! code EEXIST
npm ERR! path C:\tools\nvm\v16.14.0\yarn.cmd
npm ERR! EEXIST: file already exists
npm ERR! File exists: C:\tools\nvm\v16.14.0\yarn.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\tjh238\AppData\Local\npm-cache\_logs\2022-10-17T11_30_33_289Z-debug-0.log
PS C:\Users\tjh238\workspace\devdocs-test> npm i -g yarn --force
npm WARN using --force Recommended protections disabled.

added 1 package, and audited 3 packages in 1s

found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 8.3.1 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g npm@8.19.2 to update!
npm notice

Then problem comes when you try to use yard:

PS C:\Users\tjh238\workspace\devdocs-test> yarn
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...

(Note: there is nothing wrong with my network connction. It is just an unhelpful error.)

I spent a bit of time at Global Moot DevJam trying to debug this with Sara, but it is all a black box, so I don't know what is wrong.

Note: other people think yarn works on Windows (e.g. https://phoenixnap.com/kb/yarn-windows#ftoc-heading-4 - with the same install instructions) so I don't know why this is failing.

Are you able to provide a patch for this?

If I can help fix this, I will, but I don't know where to start.

Thanks for the detailed write-up TIm,

I don't have a Windows install available for testing at the moment, but I've been wanting to trt and migrate us to Yarn 2+ for this. I'll try and find some time this week (after the community dev meeting) to update my dev branch and let's see if that addresses things on Windows at the same time.

Note, GitPod seems to be an acceptable work-around.

(Apart from the fact it won't let me push, but downloading a git format-patch, then git am-ing and pushing from my laptop was a work-around.)

Hi Tim,

If you'd like to try running with yarn2, to see if that solves things I've just pushed a branch to #395