简体   繁体   English

npm 错误。 哈士奇 - .git 找不到 WINDOWS

[英]npm ERR! husky - .git can't be found WINDOWS

I'm trying to install mattlewis92'sangular 14.0+ calendar , which suggests the use of the command ng add angular-calendar .我正在尝试安装mattlewis92 的angular 14.0+ calendar ,这表明使用命令ng add angular-calendar However when doing so I got an error:但是,这样做时出现错误:

npm ERR! command C:\Windows\system32\cmd.exe /d /s /c husky install
npm ERR! 'husky' is not recognized as an internal or external command,
npm ERR! operable program or batch file.

I realized that I don't have husky as a dependency so I added it according to husky's docs .我意识到我没有 husky 作为依赖项,所以我根据husky 的文档添加了它。 Unfortunately after installing husky I got a new error:不幸的是,在安装了 husky 之后,我收到了一个新错误:

npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c husky install
npm ERR! husky - .git can't be found (see https://typicode.github.io/husky/#/?id=custom-directory)

I followed the suggested link above huksy docs/ Recipes/ Custom directory , but I have no common problem as package.json as well as .git and .husky are all in the same directory level -> in my project's root folder.我按照huksy docs/Recipes/Custom 目录上方的建议链接,但我没有常见问题,因为package.json以及.git都在根文件夹中。目录级别 - > myhusky '

All suggestions are welcome!欢迎所有建议!

You could你可以

1. Update your node.js version 1.更新你的node.js版本

This is the accepted node js version found over their website Node.js (>=14.19.0 or >=16.9.0)这是在他们的网站Node.js (>=14.19.0 or >=16.9.0)上找到的可接受的节点 js 版本

So if, you do not have those version -> update it.因此,如果您没有这些版本-> 更新它。

2. Use a former version 2. 使用旧版本

You do not want to update your node.js version?您不想更新您的 node.js 版本吗?
Downgrade to the following -> angular-calendar: 0.29.0降级到以下 -> angular-calendar: 0.29.0

3. Dirty Workaround 3.肮脏的解决方法

The library cannot install the calendar-utils .该库无法安装calendar-utils

Funnily enough, running npm i angular-calendar outside an angular project worked just fine有趣的是,在 angular 项目之外运行npm i angular-calendar工作得很好

So what you can do.所以你能做什么。

  1. run npm i angular-utils somewhere outside an angular project在 angular 项目之外的某个地方运行npm i angular-utils
  2. Copy the generated information node_modules , package.json & package-lock.json inside your project将生成的信息node_modules , package.json & package-lock.json到你的项目里面
  3. run npm i angular-calendar运行npm i angular-calendar
  4. Then if you which, ng add angular-calendar should work just fine.然后,如果你, ng add angular-calendar应该可以正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 npm 错误! 在 $PATH 中找不到 git 二进制文件 - npm ERR! No git binary found in $PATH Npm 错误! Windows 上不能引用换行符 - Npm ERR! Line breaks can’t be quoted on Windows 无法使用 husky 提交:.husky/pre-commit: line 4: npx: command not found - Can't commit using husky: .husky/pre-commit: line 4: npx: command not found Nexus 3 作为 npm 存储库找不到一些依赖项:npm ERR! 404未找到: - Nexus 3 as npm repository can't find some dependencies: npm ERR! 404 Not Found: npm: 错误! 可以在以下位置找到此运行的完整日志 - npm:ERR! A complete log of this run can be found in npm ERR 此运行的完整日志可在 - npm ERR A complete log of this run can be found in 预先提交时出现赫斯基错误:npm ERR:缺少脚本:预先提交 - Husky error on precommit: npm ERR! missing script: pre-commit 组合commitizen + husky时无法提交:nvm与“ npm_config_prefix”环境变量不兼容 - Can't commit when combining commitizen + husky: nvm is not compatible with the “npm_config_prefix” environment variable 无法在Windows 8上安装Yeoman-npm ERR! peerinvalid软件包yo不满足其同级的peerDependencies - Can't install Yeoman on Windows 8 - npm ERR! peerinvalid The package yo does not satisfy its siblings' peerDependencies 运行时节点版本与节点 -v 返回的不同 - husky 无法运行 git 挂钩 - Runtime node version is different than what node -v returns - husky can't run git hooks
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM