30

my package.json has the following dependency,

    {
  "name": "AppName",
  "version": "0.0.0",
  "description": "App Description",
  "author": "@author",
  "dependencies": {},
  "devDependencies": {
    "css-flip": "git://github.com/geedmo/css-flip",
    "gulp": "^3.8.10",
    "gulp-angular-htmlify": "^0.4.0",
    "gulp-changed": "^1.1.0",
    "gulp-compass": "^2.0.4",
    "gulp-concat": "^2.4.1",
    "gulp-css-flip": "^0.4.0",
    "gulp-expect-file": "0.0.7",
    "gulp-filter": "^1.0.2",
    "gulp-html-prettify": "0.0.1",
    "gulp-if": "^1.2.5",
    "gulp-ignore": "^1.2.1",
    "gulp-jade": "^0.8.0",
    "gulp-jsvalidate": "^2.0.0",
    "gulp-less": "^1.3.9",
    "gulp-livereload": "^2.1.1",
    "gulp-load-plugins": "^0.10.0",
    "gulp-minify-css": "^0.3.11",
    "gulp-ng-annotate": "^0.4.3",
    "gulp-rename": "^1.2.0",
    "gulp-sass": "^1.3.2",
    "gulp-sourcemaps": "^1.3.0",
    "gulp-sync": "^0.1.4",
    "gulp-uglify": "^1.1.0",
    "gulp-util": "^3.0.1",
    "marked": "^0.3.2",
    "through2": "^0.6.3",
    "yargs": "^3.7.2"
  },
  "scripts": {
    "prestart": "bower install",
    "start": "npm install",
    "poststart": "gulp"
  }
}

when I execute npm install command, I am getting the following error,

npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:751:12)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:110:17)
npm WARN addRemoteGit     at maybeClose (child_process.js:1015:16)
npm WARN addRemoteGit     at Socket.<anonymous> (child_process.js:1183:11)
npm WARN addRemoteGit     at Socket.emit (events.js:107:17)
npm WARN addRemoteGit     at Pipe.close (net.js:485:12)
npm WARN addRemoteGit  git://github.com/geedmo/css-flip.git resetting remote C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\git-github-com-geedmo-css-flip-git-3c35004c because of error: {
 [Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm ERR! git clone --template=C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/geedmo/css-flip.git C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remot
es\git-github-com-geedmo-css-flip-git-3c35004c: Cloning into bare repository 'C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\git-github-com-geedmo-css-flip-git-3c35004c'...
npm ERR! git clone --template=C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/geedmo/css-flip.git C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remot
es\git-github-com-geedmo-css-flip-git-3c35004c: fatal: Unable to look up github.com (port 9418) (No such host is known. )
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/geedmo/css-flip.git C:\Users\drj8c
ob\AppData\Roaming\npm-cache\_git-remotes\git-github-com-geedmo-css-flip-git-3c35004c
npm ERR! Cloning into bare repository 'C:\Users\drj8cob\AppData\Roaming\npm-cache\_git-remotes\git-github-com-geedmo-css-flip-git-3c35004c'...
npm ERR! fatal: Unable to look up github.com (port 9418) (No such host is known. )
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

I am new to node modules and git. Should i have to do any configuration related to GIT in node modules?

[Edit] : I am behind a corporate proxy. Should have to give any configuration related to that? I added proxy details in .npmrc file in users/<username>/.npmrc file. My path variable has the Git/bin location as well.

JPS
  • 2,730
  • 5
  • 32
  • 54

10 Answers10

56

This question has an answer in an other thread. The issue occurred since I was behind corporate proxy. And @bnguyen82's answer helped me finally.

I just used the following command and the issue got resolved.

git config --global url."https://".insteadOf git://
Community
  • 1
  • 1
JPS
  • 2,730
  • 5
  • 32
  • 54
  • I made this cofiguration working by removing the quotes around https:// as this: git config --global url.https://.insteadOf git:// – Yang Zhang Jul 07 '17 at 06:43
22

The accepted answer alone did not help me. Finally it worked after I cleared the npm cache using npm cache clear.

Dheeraj Vepakomma
  • 26,870
  • 17
  • 81
  • 104
  • 6
    `As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use "npm install --cache /tmp/empty-cache" to use a temporary cache instead of nuking the actual one.` Output on version 10.x – sneaky May 07 '20 at 05:16
3

1.check your internet connection
2.ping test to github.com in TERMINAL or CMD
if everything is working fine then try to use this format for your git url git+https://git@github.com/geedmo/css-flip.git

or

if you need ssh:

git+ssh://git@github.com/visionmedia/express.git

Jameel Grand
  • 2,294
  • 16
  • 32
  • the former gives fatal: unable to access https://git@github.com/geedmo/css-flip.git/: Could not resolve host: github.com and later gives `ssh: Could not resolve hostname github.com: no address associated with name` – JPS Jul 31 '15 at 11:31
  • check internet connection once – Jameel Grand Jul 31 '15 at 11:33
  • I am behind a corporate proxy. Should i have to give some configuration? i have given proxy details in .npmrc file. – JPS Jul 31 '15 at 11:34
  • 1
    that error was basic , it does not resolving github.com that means it is not in internet. – Jameel Grand Jul 31 '15 at 11:35
  • just test in your CMD or TERMINAL as "ping github.com" – Jameel Grand Jul 31 '15 at 11:37
  • i am not able to ping github in command prompt. But i am able to access internet through browser. – JPS Jul 31 '15 at 11:47
  • so your problem is not with npm . if you succeed to ping github.com then your problem is solved. – Jameel Grand Jul 31 '15 at 11:49
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/84795/discussion-between-drb-and-jameel-grand). – JPS Jul 31 '15 at 11:49
2

I had the same problem and was able to resolve it by installing git

sudo apt-get install git-all
Dmitry Samuylov
  • 1,554
  • 2
  • 14
  • 37
Setar
  • 140
  • 10
1

Git can not link to the specified URL. You can try git proxy mode. (Need their own proxy service)

Settings:

git config –global http.proxy http://127.0.0.1:1080 
git config –global https.proxy https://127.0.0.1:1080 

Cancel the setting:

git config –global –unset http.proxy 
git config –global –unset https.proxy
holdlg
  • 186
  • 1
  • 6
1

in my case, the git wasn't install on my machine.

Sima Amini
  • 331
  • 2
  • 10
0

In non-interactive mode

Git Bash in the folder where you want set up your project

expo init AwesomeProject --template blank --workflow managed --name yourappname
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
0
  1. Just observe this "css-flip": "git://github.com/geedmo/css-flip" line in your package JSON code.
  2. Your project depends upon a file css-flip which is stored in another project/repo.
  3. while installing npm, your package JSON file will try to access and download css-flip file of another repo but something might blocking it.
  4. In my case VPN blocked dependent files of other repo. So I initiated VPN and tried installing npm again npm i and it worked like magic.
GSangram
  • 123
  • 10
0

At last I kill the terminal and restart again and it worked!

Youth overturn
  • 341
  • 5
  • 7
0

In my case, I'm in a Windows environment and I'm using nvm-windows and Cygwin. I'd installed Cygwin's GIT version and I've got errors similar to those in the question regarding Error: Command failed: git.

So, I uninstalled this version and installed GIT for Windows. Then I attempted npm i again and the problem was solved.

Metafaniel
  • 29,318
  • 8
  • 40
  • 67