Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not resolve dependency #10

Open
MDG-LGofford opened this issue Mar 20, 2023 · 5 comments
Open

Could not resolve dependency #10

MDG-LGofford opened this issue Mar 20, 2023 · 5 comments

Comments

@MDG-LGofford
Copy link

Hi @guysenpai

Many thanks for this repo and supporting post on medium it's been a great help 👍🏼

I have a question regarding supporting multiple libraries which have a dependency. For example:

libs/utilities
libs/components

Where libs/components imports functions defined in libs/utilities.

Having published libs/utilities to version 1.0.8 I then attempt to installing libs/components to be told...

Could not resolve dependency:
npm ERR! peer @my-org/utilities@"0.0.1"

Have you come across this issue?

@guysenpai
Copy link
Owner

have you a .npmrc file with this content ?

@my-org:registry=https://npm.pkg.github.com

@MDG-LGofford
Copy link
Author

MDG-LGofford commented Mar 20, 2023

HI @guysenpai

Yeah, in a project I have the .npmrc file all setup correctly, and if I run npm i @my-org/utilities it installs as expected 👍🏼

However, if I npm i @my-org/components I get Could not resolve dependency: npm ERR! peer @my-org/utilities@"0.0.1" 👎🏼

The problem is that during the build of libs/components the resulting dist/libs/components/package.json is...

{
  "name": "@my-org/components",
  "version": "0.0.1",
  "repository": {
    "directory": "libs/components",
    "type": "git",
    "url": "https://github.com/my-org/my-repo"
  },
  "publishConfig": {
    "registry": "https://npm.pkg.github.com",
    "access": "public"
  },
  "main": "./src/index.js",
  "types": "./src/index.d.ts",
  "dependencies": {},
  "peerDependencies": {
    "@my-org/utilities": "0.0.1", 👈🏼 
    "tslib": "2.4.0"
  }
}

Note "@my-org/utilities": "0.0.1" when the latest published version of utilities is actually 1.0.8 🤔

@guysenpai
Copy link
Owner

Check all the versions of your utilities packages if the 0.0.1 version exists. Maybe it doesn't

@MDG-LGofford
Copy link
Author

The problems it that the build of /components will always reference version 0.0.1 of utilities....forever. This is because the libs/utilities/packages.json always says 0.0.1 - even after a publish.

@guysenpai
Copy link
Owner

you should update @my-org/utilities peerDependencies to your latest version or with ^1.0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants