- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
如何从裸 git repo 文件夹安装 npm 模块?
所以我有一个包含 git 存储库的文件夹。它是用 git init --bare
创建的。现在我想让 npm 获取最新版本的 master 分支,那里有一个可用的 package.json 文件。
正确的做法是什么?
我试过类似的东西:
npm install git+file:///W:/my/git/repo/ -g
npm install git+file:///W:/my/git/repo/#master -g
npm install file:///W:/my/git/repo/ -g --from-git
有可能吗?
npm 日志:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'file:///W:/my/git/repo/',
1 verbose cli '-g',
1 verbose cli '--from-git' ]
2 info using npm@1.4.14
3 info using node@v0.10.29
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose cache add [ 'file:///W:/my/git/repo/', null ]
6 verbose cache add name=undefined spec="file:///W:/my/git/repo/" args=["file:///W:/my/git/repo/",null]
7 verbose parsed url { protocol: 'file:',
7 verbose parsed url slashes: true,
7 verbose parsed url auth: null,
7 verbose parsed url host: '',
7 verbose parsed url port: null,
7 verbose parsed url hostname: '',
7 verbose parsed url hash: null,
7 verbose parsed url search: null,
7 verbose parsed url query: null,
7 verbose parsed url pathname: '/W:/my/git/repo/',
7 verbose parsed url path: '/W:/my/git/repo/',
7 verbose parsed url href: 'file:///W:/my/git/repo/' }
8 silly lockFile cc42952a--W-my-git-repo file:///W:/my/git/repo/
9 verbose lock file:///W:/my/git/repo/ C:\Users\myusername\AppData\Roaming\npm-cache\cc42952a--W-my-git-repo.lock
10 silly lockFile cc42952a--W-my-git-repo file:///W:/my/git/repo/
11 silly lockFile cc42952a--W-my-git-repo file:///W:/my/git/repo/
12 error addLocal Could not install file:///W:/my/git/repo/
13 error Error: ENOENT, stat 'C:\test\file:\W:\my\git\repo'
14 error If you need help, you may report this *entire* log,
14 error including the npm and node versions, at:
14 error <http://github.com/npm/npm/issues>
15 error System Windows_NT 6.2.9200
16 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "file:///W:/my/git/repo/" "-g" "--from-git"
17 error cwd C:\test
18 error node -v v0.10.29
19 error npm -v 1.4.14
20 error path C:\test\file:\W:\my\git\repo
21 error code ENOENT
22 error errno 34
23 verbose exit [ 34, true ]
最佳答案
我有一个老掉牙的答案,这可能比根本没有答案要好。使用 Git 的 URL 重写功能:
git config --global url.file://.insteadOf git+file://
npm install git+file:///c:\dev\code\mymod
它会生成有关无法获取 Remote 等的警告,但它会安装模块,并且 npm
会以成功代码退出。
这是有效的,因为 git+
前缀使 NPM 将整个路径传递给 Git,然后 URL 重写规则变成 git+file://
(一个无效的 Git 协议(protocol)string) 到 file://
(一个有效的 Git 协议(protocol)字符串)。
关于git - npm 从裸 git 文件 repo 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24910573/
采用这个 repo 结构: Server (main repo) ProjectA (subrepo) SharedLibrary (subrepo) Client (main rep
我们正在尝试使用 https://grails.org/plugin/jms用于 jms 集成。但我们无法解决它。 环顾四周,我能够验证它是否存在于这个 repo 中: http://repo.gra
是否可以在现有的 Mercurial 存储库中创建 Mercurial 存储库? 这个想法是将存储库的子目录作为不同的存储库进行处理,你是如何做到的? 我不是在谈论子存储库(至少,如果我理解子存储库的
这个问题在这里已经有了答案: How do I work with a git repository within another repository? (5 个答案) 关闭 6 年前。 我想克隆
我在尝试让 ssh 在 GIT 中工作时犯了一个灾难性的错误。 我实际上将错误的 url 从服务器复制到该存储库的配置文件中。因此,我放入配置文件的 url 是一个不同但名称相似的 repo。 现在,
我们在 github 上有数百个不再使用的存档库。 默认情况下,Github 上没有 stash 存档仓库的选项。目前,通过 active repos 是不友好的,尤其是在 github 上大量滚动。
在 .repo文件: [centos] name=centos7.2 baseurl=http://10.0.0.1/centos7.2/7.2/xxx/x86_64/ enabled=
一位同事使用 repo start 创建了功能分支 thebranch。现在我想检查这个分支并对其进行处理。我试试这个: repo init -u git@gitserver:manifest.git
我在github上托管了一个项目,结构如下 github.com/example/allpackages . ├── .git └── packages ├── example-1 ├
我在github上托管了一个项目,结构如下 github.com/example/allpackages . ├── .git └── packages ├── example-1 ├
我们可以使用 hg in -vp 将我们的本地仓库与主仓库进行比较。 如何在视觉上做到这一点?我们使用 ExamDiff extension作为我们的 Mercurial 视觉差异工具。我们认为有一种
我有一个 repo 镜像服务器 (myrepo),最初创建它是为了镜像和与远程同步(repoA)。也就是说,我使用了类似下面的东西来创建它。 cd myrepo repo init -u git://
我镜像了https://github.com/boostorg/boost.git使用命令到我自己的存储库: git clone --recursive https://github.com/boos
来自 Viewing Unpushed Git Commits我知道如何区分我自己的 repo 和本地提交: git diff origin/master..HEAD 但是,我怎样才能使用 path/
我已将我的应用程序源 (git repo) 存储在文件夹中: MyProject/front_app 但在 GitHub 上,我希望将存储库命名为 front_app 而不是 my_project_f
我有一个 repo1和 repo2在本地机器上。它们非常相似,但后者是某种其他分支(不再维护 repo1)。 /path/to/repo1 $ git log HEAD~5..HEAD~4 Add:
我在 Mac OS X (10.7.3)、x64 Intel 上更新我的 Android 源代码树时遇到问题。代码是根据 Downloading the Source Tree 安装的, 并且 SE
我有两个位于不同服务器上的存储库,分别称为 repo-1 和 repo-2。 开始两个“树干”是平等的: repo-1/trunk == repo-2/trunk 与此同时,正在向 repo-1/tr
我大约在 6 个月前加入,当我到达时,我的团队没有使用任何形式的版本控制。我已经说服 mgmt 在新项目中使用 Mercurial,所以我们在我们的网络服务器上有以下结构: -MainFolder (
我正在尝试从包含通常结构(分支、标签和主干)的 repoA 迁移到仅在主干中具有子文件夹的现有 RepoB,该 RepoB 在分支、标签和主干中具有项目和代码。 我有一个通过代码创建的转储文件: sv
我是一名优秀的程序员,十分优秀!