Got it sorted.
Whatever build of gyp is bundled in the repository is incompatible with the version in the unbuntu distro.
As long as I remove gyp from my path (sudo apt-get uninstall gyp) then I can compile LiveCode.
Of course, that means that I can no longer use gyp for any other projects.
At the moment that isn't causing me any problems because I'm using node's version, which they have renamed.
But it would be nice if we played well with others as well.
And there's no way to get build information from gyp.