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

Conflicting peer dependency: typescript@3.9.10 #626

Open
chackerian opened this issue May 27, 2022 · 2 comments
Open

Conflicting peer dependency: typescript@3.9.10 #626

chackerian opened this issue May 27, 2022 · 2 comments

Comments

@chackerian
Copy link

I'm getting this error when trying to use the package.

npm ERR! Conflicting peer dependency: typescript@3.9.10
npm ERR! node_modules/typescript
npm ERR!   peerOptional typescript@"^3.2.1" from react-scripts@3.4.3
npm ERR!   node_modules/react-scripts
npm ERR!     react-scripts@"3.4.3" from the root project
npm ERR!     peer react-scripts@">=2.1.3" from react-app-rewired@2.1.8
npm ERR!     node_modules/react-app-rewired
npm ERR!       dev react-app-rewired@"^2.1.6" from the root project

How can I properly install this? I have tried using --force and this doesn't work either.

@pedroSoaresll
Copy link

maybe npm i --legacy-peer-deps should works. This command will ignore the peer dependencies. By default, now npm is installing and validating peer deps

@lll000111
Copy link

A better way is to use the "overrides" property of package.json. See https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides

For example, I have "typescript": "^5.1.6" in devDependencies and then I have a top level package.json property

    "overrides": {
        "typescript": "$typescript"
    },

The dollar notation means it uses the exact value as specified in devDependencies - "overrides" only works if the version in "overrides" is exactly(!) the same as the one specified elsewhere. So having a version in "dependencies" or in "devDependencies", but then a "*" in "overrides" would be ignored, for example.

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

3 participants