首页 > 解决方案 > 尝试从 git 安装 npm 模块时出错

问题描述

我在 Github 上分叉和模块,根据我的需要更改它并推回 git。现在我正在尝试使用 npm 安装这个模块

npm install git+http://github.com/username/modulename.git

但我收到以下错误:

npm ERR! Command failed: git submodule update -q --init --recursive npm ERR! fatal: O:/Programs/Git/mingw64/libexec/git-core\git-submodule cannot be used without a working tree.

什么可能导致它以及如何解决它?

标签: node.jsgitnpmmodule

解决方案


检查这是否类似于此线程

经过一番调试,我确定如果我使用 URL“ https://github.com/nfroidure/ttf2woff2#master ”,这实际上是可行的。
这是因为它正在做一个不使用的浅克隆--mirror,所以它不是一个裸存储库。

所以在你的情况下:

npm install "https://github.com/username/modulename.git#master"

推荐阅读