Reputation: 1961
I created a new React TypeScript app using the starter kit - https://github.com/Microsoft/TypeScript-React-Starter#typescript-react-starter
After following the instructions, I came across the following error while trying to serve the app (i.e. after I ran npm run start
)
Failed to compile.
C:\*****\node_modules\@types\react-dom\index.d.ts (16,43): error TS2305: Module '"C:/****/node_modules/@types/react/index"' has no exported member 'ReactPortal'.
I am new to React (and vaguely familiar with Node and NPM), and I do not understand the no exported member
aspect?
Help.
Upvotes: 1
Views: 122
Reputation: 1961
Figured it out. In the initial package.json file that is used to build the node modules, under the "devDependencies"
key, the "@types/react": <version>
was different than the version under the "dependencies"
key. Ensure that these versions are consistent.
For me, the version under "dependencies"
was "^16.0.0"
, so I changed the version under "devDependencies"
to "^16.0.0"
.
Upvotes: 1