Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Installing npm module for git+https URL errors out #7083

Closed
kkleokrish opened this issue Jan 7, 2015 · 14 comments
Closed

Installing npm module for git+https URL errors out #7083

kkleokrish opened this issue Jan 7, 2015 · 14 comments
Labels

Comments

@kkleokrish
Copy link

NPM Version: 2.1.17

npm install using the command line of the form

npm install git+https://domain/dir/repo.git

fails with

Command failed: fatal: could not create work tree dir 'd:\test\npm-10856-e1a1dfc8\1420633333522-0.860646930988878\4feb1e9760e5ae6c15b4d41fd6c5115feb7cacd3'.: No such file or directory

Tracking the issue, it seems to happen from add-remote-git.js cache method.

function cache (p, u, treeish, resolved, cb) {
 var tmp = path.join(npm.tmp, Date.now()+"-"+Math.random(), treeish)

It is using directory pointed in tmp without first creating it.

Adding the line mkdir(tmp); after these two lines seems to fix the issue

@smikes
Copy link
Contributor

smikes commented Jan 7, 2015

Thanks for the bug report and candidate fix! /cc @othiym23 Windows + git problem

@thirdcreed
Copy link

Awesome! Glad this is known. I had same problem, with git+ssh, npm 2.1.16

@othiym23
Copy link
Contributor

othiym23 commented Jan 8, 2015

Good catch. I'll see if I can get this into today's release (along with a more consistent way of naming tmp directories -- 0.138124314 or whatever in tmp directory names works but looks pretty strange).

@thirdcreed
Copy link

Is this fixed in 2.2?

@baffles
Copy link

baffles commented Jan 15, 2015

It doesn't appear to be fixed anywhere yet? I tried 2.2.0 and 2.1.18.

@smikes
Copy link
Contributor

smikes commented Jan 15, 2015

I believe this did not make it into 2.2.0, but 2.2.1 is scheduled to be out today and may contain it.

@othiym23
Copy link
Contributor

Yeah, sorry, it slipped between the cracks in last week's release, which is my fault. Sorry! I'll try to get in in there for today's release. It should be a simple enough fix.

@othiym23
Copy link
Contributor

I have a candidate fix for this, which I'll go ahead and merge, but I have a problem: I can't get this bug to reproduce, with or without the patch! What versions of Git and Windows are those of you with this problem running?

@baffles
Copy link

baffles commented Jan 16, 2015

I'm on Windows 7 with git version 1.8.5.2.msysgit.0.

For what it's worth, the fix in the original bug report solved the issue for me.

@othiym23
Copy link
Contributor

OK, I'm running Git 1.9.something and Windows 8.1, so maybe that accounts for it. I've landed cc2e099, which includes a better algorithm for naming the temporary directory as well as ensuring the path exists before running Git on it, so it should also fix the problem. I'll need all of you to verify that npm@2.3.0 fixes this problem.

@othiym23
Copy link
Contributor

Run npm -g i npm@next (npm@2.3.0) and tell me if you can now use git+whatever: URLs, please!

@baffles
Copy link

baffles commented Jan 16, 2015

I'll check it out in a few hours and report back!

@baffles
Copy link

baffles commented Jan 17, 2015

Working now on my end! 👍 Thanks!

@othiym23
Copy link
Contributor

Great! ☺️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants