Questions tagged [peer-dependencies]
99 questions
4
votes
1 answer
How to remove optional peer dependency from NPM project?
I am participating in building a webapp that used to use node-sass. We migrated to sass in the meantime but we have still node-sass in our package-lock.json. I want to fix that.
In the beginning, we had something like this
$ npm ls…

Christian Wolf
- 1,187
- 1
- 12
- 33
4
votes
0 answers
What's wrong here I have to do NPM link on "react": "^16.13.1" because app report duplicate React
It started with this error:
So I did a test to rule out what the problem was. I tested if the library Notistack that I hade forked from GitHub, and then linked with npm link to my app, was the problem.
I placed this code in the app
window.React2 =…

Kid
- 1,869
- 3
- 19
- 48
4
votes
2 answers
Is it possible to have Material UI as peerDependency but keep its types as DevDependency?
Is it possible to have Material UI as peerDependency but keep its types as DevDependency?
I am building a component library using React + Typescript and the components are based on Material UI library, with Rollup as module bundler.
Here is an…

André Borba Netto Assis
- 93
- 1
- 8
4
votes
0 answers
'More than one copy of React' - Cannot bundle component library with Rollup
I am encountering the dreaded 'You might have more than one copy of React in the same app' error when I try to use a local React component library (bundled with rollup) in my host app (note: this only happens when I use hooks). It seems damn near…

randy
- 41
- 3
4
votes
2 answers
How can I get React styleguidist to install correctly and get past the peer Dependency issues with react-simple-code-editor: React 16 & 17?
I am in the process of learning React by reading the Fullstack React book.
My setup:
node -v
v14.15.3
npm -v
7.3.0
Following the styleguidist install guide I ran:
npm -i -D webpack react-styleguidist
This installed:
webpack…

JGFMK
- 8,425
- 4
- 58
- 92
4
votes
0 answers
Should I bother resolving npm peer dependencies myself?
I seem to have gone down a rabbit hole with this. While I'm using webpack as an example, I'm looking for an answer that isn't specific to webpack. Ideally, I'd like to resolve these, but should I even bother?
I have an application whose dependencies…

coblr
- 3,008
- 3
- 23
- 31
3
votes
2 answers
Create a TypeScript library with optional dependencies resolved by application
I've written a library published to a private npm repo which is used by my applications.
This library contains utilities and has dependencies to other libraries, as an example let's choose @aws-sdk/client-lambda.
Some of my applications use only…

JHH
- 8,567
- 8
- 47
- 91
3
votes
0 answers
NPM peer dependency conflict
I have my-package that has @angular/common@"^12.2.6" as peer dependency and root project that also has @angular/common@"^12.2.6" as a dependency, but npm install is giving me this error:
npm ERR!
npm ERR! Conflicting peer dependency:…

aljazerzen
- 429
- 5
- 19
3
votes
1 answer
Account for multiple peer dependency versions in react-typescript library
I am converting my react component library react-esri-leaflet over to typescript. The library requires the user to install react-leaflet as a peerDependency, and it provides support for react-leaflet version 3 (RLV3), as well as react-leaflet…

Seth Lutske
- 9,154
- 5
- 29
- 78
3
votes
1 answer
How do I re-use sub-dependencies with NPM correctly?
This question is mostly based on react-admin, hence the tags, but it's probably also useful in other situations.
So we have react-admin which depends on @material-ui/core. This allows me to use Material UI in my own code while implementing the UI…

Nikolai Prokoschenko
- 8,465
- 11
- 58
- 97
3
votes
1 answer
npm: refer to a peer dependency; how to align the version from a peer dependency
In abstract, I'm ok with the provided version of dependency-B, which is already installed thanks to dependency-A.
"dependencies": {
"dependency-A": "x.y.z",
}
$> npm ls --depth=1
├─┬ dependency-A@x.y.z
│ ├── dependency-B@x.y.z
So when I…

Manu Artero
- 9,238
- 6
- 58
- 73
3
votes
4 answers
Problem using yarn link to consume local npm package that has peerDependencies
I am running into the following problem when trying to develop a React component library using styled-components.
For the purpose of this example, let's assume we have two repos, app and core and that core will be consumed by app.
Currently, core…

pengurino
- 41
- 1
- 3
3
votes
0 answers
NPM resolve peer dependencies with transitive dependencies
I have 3 packages A, B, C, and the i'm developing in requires that package A has B and C as dependecies, but the problem here is that package C also depends on package B, below block describing the case.
So i was thinking of having Package B as…

M1M6
- 915
- 3
- 17
- 33
3
votes
0 answers
Conditional import of peerDependency in es6
I am working on a JavaScript i18n library which localize dates (among other types and objects).
It is currently relying on moment.js, which is defined as a peerDependency (localization is one of the features but not the only one, it might not be…

Flo Schild
- 5,104
- 4
- 40
- 55
2
votes
0 answers
Errors Type 'Interpolation' is not assignable to type 'InterpolationWithTheme' of emotion and Twilio, dependencies clashing
I have been using "@emotion/styled": "11.10.5", and didn't have any problem, but since I started using the Twilio library "@twilio/flex-webchat-ui": "^2.9.1", now the terminal is full of errors like this ones: (error logs picture)
error TS2322:…

carlitos_alcaraz
- 21
- 3