Alpesh Prajapati
Alpesh Prajapati

Reputation: 1643

how to install dependencies with specific version while installing one module in npm

I want to install dependencies with specific version while installing one module.

Let's say I want to install react-virtualized-select module. It has a dependency on react-virtualized module. So when I run 'npm install react-virtualized-select', It installs latest version(9.11.0) of 'react-virtualized' module. But I want to install specific version (9.9.0) of 'react-virtualized' module.

I tried doing below in package.json

 "peerDependencies": {
   "react-virtualized-select/react-virtualized": "9.9.0"
 },

but shows below message.

 +-- [email protected]
 `-- UNMET PEER DEPENDENCY react-virtualized-select/[email protected] 

Upvotes: 0

Views: 4278

Answers (3)

Jay
Jay

Reputation: 328

You can try this way!

Syntax,

npm i packageName@versionNumber

For example,

npm i [email protected]

Upvotes: 1

maxcc00
maxcc00

Reputation: 345

Maybe you can share why you want another version of a dependency.
A module controls dependencies through its package.json. It knows which version it depends on and installs that version. Overriding that dependency may give you unwanted results. If you want another version installed, you can add that in your package json.

react-virtualized-select: '^9.11.0',
react-virtualized: '<version>'

Upvotes: 0

Saad Khan
Saad Khan

Reputation: 108

run command

npm install --save [email protected]

Upvotes: 0

Related Questions