最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

github - getting error when trying to add a forked repository's specific commit with yarn - Stack Overflow

programmeradmin1浏览0评论

I'm trying to use a forked repository in a react app which dependencies are managed by yarn. When adding "@react-oauth/google": "git+.git#7f71538b0d79dbd46012aa593975f869c5bb8a28" which should be the correct format, to my package.json, I get this error

yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @react-oauth/[email protected]" has unmet peer dependency "react@>=16.8.0".
warning " > @react-oauth/[email protected]" has unmet peer dependency "react-dom@>=16.8.0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > rollup-config-generator > [email protected]" has unmet peer dependency "@babel/core@7 || ^7.0.0-rc.2".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @chakra-ui/[email protected]" has unmet peer dependency "@chakra-ui/system@>=2.0.0-next.0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @chakra-ui/icons > @chakra-ui/[email protected]" has unmet peer dependency "@chakra-ui/system@>=2.0.0-next.0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @emotion/react > @emotion/[email protected]" has unmet peer dependency "@babel/core@^7.0.0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @emotion/react > @emotion/babel-plugin > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @chakra-ui/react > @chakra-ui/modal > @chakra-ui/focus-lock > [email protected]" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
[4/4] Building fresh packages...
$ is-ci || husky install
husky - Git hooks installed
Done in 29.85s.

yarn pack v1.22.22
error Package doesn't have a version.
info Visit  for documentation about this command.

There is no package version here as I'm targeting a commit. Any clue ? Thanks

I tried adding the forked repository several ways, by adding it to my package.json file, or with the yarn add command. It looks like it's finding the repository, but this 'package error' is showing up, when it shouldn't.

I'm trying to use a forked repository in a react app which dependencies are managed by yarn. When adding "@react-oauth/google": "git+https://github/thanhnh2-miichisoft/react-oauth.git#7f71538b0d79dbd46012aa593975f869c5bb8a28" which should be the correct format, to my package.json, I get this error

yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @react-oauth/[email protected]" has unmet peer dependency "react@>=16.8.0".
warning " > @react-oauth/[email protected]" has unmet peer dependency "react-dom@>=16.8.0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > rollup-config-generator > [email protected]" has unmet peer dependency "@babel/core@7 || ^7.0.0-rc.2".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @chakra-ui/[email protected]" has unmet peer dependency "@chakra-ui/system@>=2.0.0-next.0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @chakra-ui/icons > @chakra-ui/[email protected]" has unmet peer dependency "@chakra-ui/system@>=2.0.0-next.0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @emotion/react > @emotion/[email protected]" has unmet peer dependency "@babel/core@^7.0.0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @emotion/react > @emotion/babel-plugin > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
warning "workspace-aggregator-56dd2615-2828-4f58-bd57-479a5614108d > playground > @chakra-ui/react > @chakra-ui/modal > @chakra-ui/focus-lock > [email protected]" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
[4/4] Building fresh packages...
$ is-ci || husky install
husky - Git hooks installed
Done in 29.85s.

yarn pack v1.22.22
error Package doesn't have a version.
info Visit https://yarnpkg/en/docs/cli/pack for documentation about this command.

There is no package version here as I'm targeting a commit. Any clue ? Thanks

I tried adding the forked repository several ways, by adding it to my package.json file, or with the yarn add command. It looks like it's finding the repository, but this 'package error' is showing up, when it shouldn't.

Share Improve this question edited Dec 4, 2024 at 20:01 TwiN 1,9111 gold badge17 silver badges27 bronze badges asked Nov 21, 2024 at 4:34 tgm2025tgm2025 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

The package.json of the git repo has no version field, and thus is not a valid package.json.

Seems like you need to depend on a sub-workspace of the repo instead. Unfortunately, Yarn v1 cannot specify a subdirectory of a GitHub repo as dependency, as far as I know.

发布评论

评论列表(0)

  1. 暂无评论