gpt4 book ai didi

node.js - 尝试安装 git 存储库时出现 npm 错误

转载 作者:太空宇宙 更新时间:2023-11-04 03:26:48 25 4
gpt4 key购买 nike

在遵循另一个 SO 之后,我试图包含尚未推送到 npm 的最新版本的 git 存储库 (LeafletJS)。

packages.config 被剪断:

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

那么,

npm install

报告

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

最佳答案

做一个简单的:

$ 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

(开发版本链接位于传单顶部 download page )

您还可以通过 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>

(您不会将其保留用于生产,因为这些文件会不断变化......)

关于node.js - 尝试安装 git 存储库时出现 npm 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43679655/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com