Module not found: Error: Can't resolve 'react-select' with typescript

Viewed 17985

module import is not working for me. I'm tried different solutions provided from stack overflow and other. These are steps I'm follow the react-select

npm install --save @types/react-select

import the module like this

import Select from "react-select"

but I got the error

Module not found: Error: Can't resolve 'react-select'

import * as React from "react";
import ReactSelect from 'react-select'
export class Select extends extends React.Component<someProps>{

render(){
   return(
  <Select id="color" options={options} />
);
}
}

But I can't find the way to fixed this.

3 Answers

I got solution by npm i react-select.

You have an error:

npm install --save @type/react-select

instead of

npm install --save @types/react-select

Also I would recommend to use --save-dev instead of --save because you don't need typings in production.

I found the issue having here. Issue is both @types/react-select and react-select added to the package.json

Related