簡體   English   中英

嘗試安裝git倉庫時出現npm錯誤

[英]npm error trying to install git repository

在遵循另一種SO之后,我試圖包含尚未推送到npm的最新版本的git repo(LeafletJS)。

packages.config片段:

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

然后,

npm install

報告

npm WARN addRemoteGit錯誤:命令失敗:git -c core.longpaths = true配置--get remote.origin.url

npm警告addRemoteGit

在ChildProcess.exithandler上的npm WARN addRemoteGit(child_process.js:206:12)

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

在ChildProcess.emit上的npm WARN addRemoteGit(events.js:191:7)

npm WARN addRemoteGit可能在Close(內部/ child_process.js:877:16)

npm WARN addRemoteGit在Process.ChildProcess._handle.onexit(內部/child_process.js:226:5)

npm WARN addRemoteGit git + https:// {token}:x-oauth-basic@github.com/Leaflet/Leaflet.git重置遠程C:\\ Users \\ bob \\ AppData \\ Roaming \\ npm-cache_git-remotes \\ git-https -{token} -x-oauth-basic- github-com-Leaflet-Leaflet-git-b27a5a7d由於錯誤:{錯誤:命令失敗:git -c core.longpaths = true config --get remote.origin.url

npm警告addRemoteGit

在ChildProcess.exithandler上的npm WARN addRemoteGit(child_process.js:206:12)

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

在ChildProcess.emit上的npm WARN addRemoteGit(events.js:191:7)

npm WARN addRemoteGit可能在Close(內部/ child_process.js:877:16)

npm WARN addRemoteGit在Process.ChildProcess._handle.onexit(內部/child_process.js:226:5)

npm WARN addRemoteGit被殺死:false,

npm WARN addRemoteGit代碼:1,

npm WARN addRemoteGit信號:null,

npm WARN addRemoteGit cmd:'git -c core.longpaths = true配置--get remote.origin.url'}

做一個簡單的:

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

從Leaflet存儲庫正確安裝最新的主版本(即在撰寫本文時git+https://github.com/Leaflet/Leaflet.git#66cf6a0ea1df84dfcae441e91a9aa3bd66531030

話雖這么說,不幸的是,從源存儲庫中獲取Leaflet可能不是最佳選擇。 實際上,您將不會獲得dist文件。 並且嘗試從node_modules目錄構建它們可能不起作用,因為Leaflet生成過程使用git-rev-sync ,它需要在git版本控制的文件夾中運行,而通過npm提取包時則不是這種情況……

但是您可以通過以下鏈接輕松手動下載當前的主版本:

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

(位於傳單下載頁面頂部的開發版本鏈接)

您也可以通過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>

(您不會將其保留在生產中,因為這些文件將不斷變化……)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM