DEV Community

Aashutosh Poudel
Aashutosh Poudel

Posted on

5 2

Install multiple versions of same package using yarn

I had an issue in react native with libraries: react-native-picker-select and @react-native-picker/picker. react-native-picker-select uses @react-native-picker/picker internally, and the version is far behind the current version. So I tried installing the latest version of @react-native-picker/picker separately but got an error saying: RNCAndroidDialogPicker was declared twice or something similar.

Anyways, I couldn't solve the issue but found aliases in npm/yarn.

With aliases you could add node packages with a different name and import them without any issues.

yarn add your-custom-name@npm:@react-native-picker/picker
Enter fullscreen mode Exit fullscreen mode

This way I can define a new name for the latest version of the @react-native-picker/picker library and import it in my components with the new name. The same name will be added to the package.json file.

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs