It wasn't just my machine
The first line in the setup notes is vagrant up, and on my machine it took most of a week to do what it says.
I’m three weeks into the new agency. The environment has worked for about two of them. So this is written from the far side, which is the only side anybody writes these from.
When you’re new and something doesn’t work, the first explanation you reach for is yourself, because it usually is yourself. You skipped a line in the notes. You typed a path wrong. You’re on the wrong branch. Every one of those has been true of me before, and none of them was true here. But I hadn’t earned the right to skip past them yet.
Of course it was me
Most of what we build here is Magento 2, and running Magento 2 on your own machine is a project in itself. The notes describe a virtual machine that Vagrant builds and VirtualBox runs, with the project folder shared between the two, so you edit files on your own machine and the store runs inside the box. You bring the box up, log into it, and run a setup script that installs everything else. Everybody’s box is built from the same file. That’s the promise, the same box on every machine.
Mine got as far as the first command. Here’s the trail, more or less in order.
VT-x is disabled in the BIOS for all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)
/bin/bash^M: bad interpreter: No such file or directory
proc_open(): fork failed - Cannot allocate memory
Each of those is a different layer saying no. The first is the machine’s own firmware, which had virtualization switched off. A lot of machines apparently arrive that way. The second is git on Windows helpfully giving the setup script Windows line endings, which the Linux inside the box then couldn’t run. The third is Composer running out of memory in a box that had been given 1 GB, where Magento’s docs recommend at least 2 GB.
I took every one of them personally. Each arrived looking like something I’d done wrong, so I went back over the notes for the step I’d skipped. There wasn’t one. I didn’t ask anybody for a day and a half. Asking meant walking up to somebody in my first week and saying that I couldn’t get the project to run, which is a sentence with a subtext, and the subtext is the whole reason people don’t say it. There’s a version of the next 12 months where I’m the person who’s good at CSS and a version where I’m the hire nobody can quite explain. It felt like this was deciding which.
Have you tried turning it off and on again?
Then I asked. The lead developer pulled a chair over and stayed for most of an afternoon, and then most of the next one.
It wasn’t glamorous. Fix one thing, run the step again, wait several minutes while it gets a little further than last time, read the next error. A BIOS setting and a reboot. A git setting and a fresh clone. More memory in the Vagrantfile. By the end of the second afternoon the store loaded, at about 40 seconds a page, because the shared folder is slow and Magento reads a lot of small files on every request. It’s better now. I wouldn’t call it fast.
Somewhere in the middle of it I apologized for how long this was taking. One of the other developers on Windows said, without looking up, that theirs had taken a week.
Works on my machine
That’s the part I’ve been thinking about since.
Nothing was wrong with my machine that isn’t wrong with every Windows machine here. There are about 10 of us on the development side and a few of us are on Windows. Every one of the others has been through some version of that list. The notes were accurate for whoever last followed them, on whatever machine that was. Every fix since then happened once, on one laptop, and got forgotten there.
Which makes sense, really. Once the box runs you have no reason to rebuild it, and a box that works is a box nobody touches for a year. So the only person who ever runs the setup from scratch is whoever joined most recently. Nobody chose that. It just means the setup’s bugs only ever get found by the person with the least context, the least standing to say something looks wrong, and the strongest reason to assume the problem is them.
I don’t think anybody was keeping it from me. The moment a thing gets fixed is the moment the person who fixed it stops thinking about it. I’ve put the fixes in the notes, each one under its error message, since the error message is the one thing the next person is guaranteed to search for.
Grunt, because Magento
Once the store ran, the next thing in the notes was the front-end build.
Magento 2 comes with its own build for its LESS, and it’s Grunt. Every install has a Gruntfile.js.sample and a package.json.sample sitting in the root. You rename them, run npm install, add your theme to dev/tools/grunt/configs/themes.js, and grunt watch recompiles as you work. The sample package.json asks for Grunt ^0.4.5, which is older than the Grunt 1.0 that came out in April.
npm install fell over too, since Windows won’t let the box create symlinks in a folder it shares with the host and npm makes a few on every install. The fix is --no-bin-links, a flag whose whole reason for existing is this exact situation. I spent an hour on that one by myself first, assuming, naturally, that it was me.
Last November I spent a week of evenings moving my own site from Grunt to Gulp and wrote a post saying I’d use Gulp for anything new. The first platform I’ve worked in full-time since then handed me Grunt back, and I’ve run it every day for two weeks without once wondering whether I should.
That’s a less impressive account of how I pick tools than the one I’d give in an interview, where I’d say something about assessing tradeoffs. I don’t really evaluate them. I mostly use whatever is in front of me, and I suspect what I mostly do is be available lol. In fairness, that Gulp post already suspected the important thing wasn’t which tool won. A platform settling it for me without asking is about as clear a demonstration as I could have wanted.
The week I don’t really mind. It gets me that every Windows developer here has had their own version of it. Each of them started it alone and assumed it was them, since for somebody new that really is the likeliest explanation. The fix for all of it is a handful of error messages and what to do about each one, written down, which is about the least interesting document anybody will ever write. The only time anybody’s going to write it is the week they still remember needing it, and that week belongs to the newest person too.