0

Having followed another SO, I am trying to include the latest version of a git repo (LeafletJS) that has yet to be pushed to npm.

The packages.config snipped:

"dependencies": {
 "leaflet": "git+https://{git hub generated token}:x-oauth-basic@github.com/Leaflet/Leaflet.git",

then,

npm install

reports

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:206:12)

npm WARN addRemoteGit at emitTwo (events.js:106:13)

npm WARN addRemoteGit at ChildProcess.emit (events.js:191:7)

npm WARN addRemoteGit at maybeClose (internal/child_process.js:877:16)

npm WARN addRemoteGit at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

npm WARN addRemoteGit git+https://{token}:x-oauth-basic@github.com/Leaflet/Leaflet.git resetting remote C:\Users\bob\AppData\Roaming\npm-cache_git-remotes\git-https-{token}-x-oauth-basic- github-com-Leaflet-Leaflet-git-b27a5a7d because of error: { 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:206:12)

npm WARN addRemoteGit at emitTwo (events.js:106:13)

npm WARN addRemoteGit at ChildProcess.emit (events.js:191:7)

npm WARN addRemoteGit at maybeClose (internal/child_process.js:877:16)

npm WARN addRemoteGit at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

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' }

jenson-button-event
  • 15,947
  • 8
  • 73
  • 144
  • Do you really need to use your GitHub token? Leaflet is a public repo – ghybs Apr 28 '17 at 12:28
  • @ghybs its a good question, I dont know. was just following what i saw http://stackoverflow.com/questions/23210437/npm-install-private-github-repositories-by-dependency-in-package-json and tried all ways same result – jenson-button-event Apr 28 '17 at 13:20
  • Can Leaflet be used server side? ....there's this - https://www.npmjs.com/package/leaflet, but I can't find any examples of Node.js usage – timborden Apr 28 '17 at 14:58

1 Answers1

3

Doing a simple:

$ npm install --save https://github.com/Leaflet/Leaflet.git

correctly installs the latest master version from Leaflet repository (i.e. git+https://github.com/Leaflet/Leaflet.git#66cf6a0ea1df84dfcae441e91a9aa3bd66531030 at time of writing)

That being said, fetching Leaflet from the source repository might not be the best option for your need unfortunately. Indeed, you will not get the dist files. And trying to build them from your node_modules directory might not work, because the Leaflet build process uses git-rev-sync, which needs to be run in a git version controlled folder, which is not the case of your package when fetched through npm

But you can very easily manually download the current master version on this link:

https://leafletjs-cdn.s3.amazonaws.com/content/leaflet/master/leaflet.zip

(dev version link at the top of Leaflet download page)

You can also use them through CDN:

<link href="https://leafletjs-cdn.s3.amazonaws.com/content/leaflet/master/leaflet.css" rel="stylesheet" type="text/css" />
<script src="https://leafletjs-cdn.s3.amazonaws.com/content/leaflet/master/leaflet-src.js"></script>

(you will not keep that for production, as these files will keep on changing…)

ghybs
  • 34,277
  • 5
  • 51
  • 73