[英]Receive a Git Error When Trying to npm a Forked Repo
Goal:目标:
Utilize a javascript library using the javascript package manager npm
to install the pdf-viewer-reactjs
package using a forked repository of the primary repository. Utilize a javascript library using the javascript package manager
npm
to install the pdf-viewer-reactjs
package using a forked repository of the primary repository.
I have forked the repository, now located here -- https://github.com/Evilsmaher/pdf-viewer-reactjs (so you can visually see it).我已经分叉了存储库,现在位于此处——https://github.com/Evilsmaher/pdf-viewer-reactjs (所以你可以直观地看到它)。
Current Efforts:目前的努力:
npm install <ghusername>/<repoName>
: npm install and build of forked github reponpm install <ghusername>/<repoName>
安装: npm install and build of fork github reponpm install --save Evilsmaher/pdf-viewer-reactjs
npm install --save Evilsmaher/pdf-viewer-reactjs
npm ERR! code
npm ERR! git dep preparation
npm ERR! command C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\bratl\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-
npm ERR! > pdf-viewer-reactjs@3.0.0-beta.2
npm ERR! > husky
npm ERR! npm WARN using --force Recommended protections disabled
npm ERR! C:\Users\bratl\AppData\Local\npm-cache\_cacache\tmp\git-cloneIFcXeD\node_modules\husky\lib\commands\install.js:20 npm ERR
throw new Error(".git can't be found
npm ERR!
npm ERR
npm ERR! Error: .git can't be
npm ERR! at Object.install (C:\Users\bratl\AppData\Local\npm-cache\_cacache\tmp\git-cloneIFcXeD\node_modules\husky\lib\commands\install.js:20:15
npm ERR! at Object.<anonymous> (C:\Users\bratl\AppData\Local\npm-cache\_cacache\tmp\git-cloneIFcXeD\node_modules\husky\lib\bin.js:51:19
npm ERR! at Module._compile (node:internal/modules/cjs/loader:1101:14
npm ERR! at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10
npm ERR! at Module.load (node:internal/modules/cjs/loader:981:32
npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:822:12
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) npm ERR! at node:internal/main/run_main_module:17:
npm ERR! npm ERR! code
npm ERR! npm ERR! path C:\Users\bratl\AppData\Local\npm-cache\_cacache\tmp\git-
npm ERR! npm ERR! command
npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c husky
npm ERR
npm ERR! npm ERR! A complete log of this run can be found in
npm ERR! npm ERR! C:\Users\bratl\AppData\Local\npm-cache\_logs\2022-08-23T22_54_30_663Z-debug.
npm ERR! A complete log of this run can be found in
npm ERR! C:\Users\bratl\AppData\Local\npm-cache\_logs\2022-08-23T22_55_15_225Z-debug.log
package.json
package.json
中的依赖项安装"dependencies": {
"pdf-viewer-reactjs": "https://github.com/Evilsmaher/pdf-viewer-reactjs.git"
}
Output : Same as #1 Output :与#1相同
git clone https://github.com/Evilsmaher/pdf-viewer-reactjs.git
git clone https://github.com/Evilsmaher/pdf-viewer-reactjs.git
项目npm link
to the directory.npm link
到该目录。npm link../pdf-viewer-reactjs
Question : What is the correct way to install a forked repository of a Javascript library into my current project, so I can customize a current repo and still use the package?问题:将 Javascript 库的分叉存储库安装到我当前的项目中的正确方法是什么,以便我可以自定义当前存储库并仍然使用 package?
Thanks!谢谢!
This is a bit similar to husky
issue 851这个有点像
husky
issue 851
Check if you are in a similar use case:检查您是否处于类似的用例中:
I am having this same issue when trying to install husky on a repo where I have multiple projects and the
.git
file is up a directory.尝试在我有多个项目且
.git
文件位于目录的存储库上安装 husky 时,我遇到了同样的问题。
Are there configuration options for this use case?此用例是否有配置选项?
I have two projects with node modules nested inside one git repo for the sanity CMS and the Gatsby FE.我有两个项目,其中节点模块嵌套在一个 git 存储库中,用于 sanity CMS 和 Gatsby FE。
Could you please place a recursive test to check if the.git folder exists in the parent, then parent's parent, then parent's parent's parent... folder.
您能否进行递归测试以检查.git 文件夹是否存在于父级,然后是父级的父级,然后是父级的父级父级...文件夹中。
In the real world, it happens that the GIT is a mono-repo that contains differents folders with different projects with a
package.json
in each.在现实世界中,碰巧 GIT 是一个单一存储库,其中包含具有不同项目的不同文件夹,每个文件夹中都有
package.json
。
Also:还:
The case you may be in is if your
package.json
file and.git
directory are not at the same level.您可能遇到的情况是,如果您的
package.json
文件和.git
目录不在同一级别。
For example,project/.git
andproject/front/package.json
.例如,
project/.git
和project/front/package.json
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.