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

[ts] Cannot find module 'react' after installling @types/react-router-dom #17590

Closed
3 tasks
jrmcdona opened this issue Jun 28, 2017 · 3 comments
Closed
3 tasks

Comments

@jrmcdona
Copy link

jrmcdona commented Jun 28, 2017

  • [x ] I tried using the @types/xxxx package and had problems.
  • I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • Mention the authors (see Definitions by: in index.d.ts) so they can respond.
    • Authors: @....

Hello @tkrotoff @huy-nguyen

I just installed @types/react-router-dom. My project can no longer recongize React and React-dom.
See package.json below.

image

{
  "name": "responder",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@types/jest": "^20.0.2",
    "@types/node": "^8.0.5",
    "@types/react": "^15.0.33",
    "@types/react-dom": "^15.5.1",
    "@types/react-router-dom": "^4.0.5",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-router-dom": "^4.1.1",
    "react-scripts-ts": "2.3.2"
  },
  "devDependencies": {
    "typescript": "^2.4.1"
  },
  "scripts": {
    "start": "react-scripts-ts start",
    "build": "react-scripts-ts build",
    "test": "react-scripts-ts test --env=jsdom",
    "eject": "react-scripts-ts eject"
  }
}

Any idea there?

Thanks

@tkrotoff
Copy link
Contributor

Delete node_modules directory, close your editor, npm install/yarn, wait, reopen your editor

@jrmcdona
Copy link
Author

jrmcdona commented Jun 29, 2017

That fixed it although now it cannot find Node modules 'process' or 'require' but they may be because I upgraded TypeScript.

Will log different issue

@Naaman233
Copy link

I just experienced this problem. First make sure your node_modules is present. Incase it is, delete it and run npm i or yarn install. Also make sure your node package manager is on v11.0.0. its recommended for react

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