Open KevinBatdorf opened 7 years ago
Hm unfortunately none of us work on cygwin, so a PR would be helpful
This might be Cygwin + Windows Git not playing well together. Try installing Cygwin Git and see if that helps.
Even better: If possible, you should totally ditch Cygwin and instead use Windows Subsystem for Linux. It's much smoother and you get a legit Linux environment (powered by Ubuntu) rather than a half-Linux-half-Windows cross-compiled hybrid like Cygwin 😛 .
Unfortunately the PC I have this on is the Enterprise version of Windows which doesn't have that Creator's update yet with the Linux subsystem =/
It's not critical though that I fix this, but in case someone else needs too, here's what I discovered so far. I'm also not well-versed in NodeJS, although I definately enjoyed learning how Yarn works.
I think the issue is with using NodeJS's file functions like how:
this.cwd = this.config.getTemp(crypto.hash(this.gitUrl.repository));
will use
this.tempFolder = opts.tempFolder || path.join(this.cacheFolder, '.tmp');
and ultimately
// not a strict polyfill for Node's fs.mkdtemp
export async function makeTempDir(prefix?: string): Promise<string> {
const dir = path.join(os.tmpdir(), `yarn-${prefix || ''}-${Date.now()}-${Math.random()}`);
await unlink(dir);
await mkdirp(dir);
return dir;
}
I couldn't figure out how to set that opts.tempFolder
actually. Is that possible?
Anyway, I got a lot of it to work by hard-coding directories in there, but then I got stuck on
if (await fs.exists(cwd)) {
await spawnGit(['pull'], {cwd});
} else {
await spawnGit(['clone', gitUrl.repository, cwd]);
}
which would return false, attempt to pull in the repo and fail as the directory isn't empty. That's when I decided to move on with my life :D
I couldn't figure out how to set that opts.tempFolder actually. Is that possible?
It should just be a matter of adding --temp-folder
inside your command line or a yarnrc file, along with a linux-style path. I think the issue here is that os.tmpdir()
is returning a Windows path, but the path
functions are operating on linux-style paths (where C:
is a valid directory name) :/
A workaround for someone else in my position. Set up a virtual machine with Vagrant and Virtualbox and put /home/Kevin/code
as a shared folder, ssh into the virtual machine and run yarn install
from there without issue.
I used Laravel Homestead
I hit this issue today. My solution was to uninstall git from cygwin and use the git from chocolatey.
My theory is that the git install using chocolatey understands windows path while cygwin's version does not.
git install using chocolatey understands windows path while cygwin's version does not.
Cygwin's version uses their POSIX conversion layer, which can sometimes do strange things to paths as it needs to support both "Windows-style" and "Unix-style" paths. The version installed via Chocolatey is likely the MinGW/msys compiled version, which is closer to native.
I tried this on the Windows Linux Subsystem on Ubuntu as well and got the same error. Yarn error log attached. yarn-error.log
This still doesn't work with yarn 1.13.0.
Setting --cache-folder
doesn't work either. For example, setting it to /tmp
just produces:
fatal: Invalid path '/home/Kevin/Code/theNextFacebook/C:\foo\.tmp\d467663531f204616cf61ecefbe7254c': No such file or directory
Do you want to request a feature or report a bug? Report a bug.
What is the current behavior?
yarn install
fails with this error:which appears to be a relative path issue.
Please mention your node.js, yarn and operating system version.
Windows 10