enzymejs / enzyme

JavaScript Testing utilities for React
https://enzymejs.github.io/enzyme/
MIT License
19.95k stars 2.01k forks source link

Error: Cannot find module 'react/addons #1568

Closed ereztdev closed 6 years ago

ereztdev commented 6 years ago

Posted as a new issue per request from @ljharb : Hey guys, I am experiencing an issue: Error: Cannot find module 'react/addons' this is my package local:

  "dependencies": {
    "browser-sync": "^2.23.6",
    "browserify": "^16.1.1",
    "ejs": "^2.5.7",
    "express": "^4.16.2",
    "gulp": "^3.9.1",
    "gulp-live-server": "0.0.31",
    "react": "^16.2.0",
    "reactify": "^1.1.1",
    "vinyl-source-stream": "^2.0.0"
  }

and this is my global:

PS C:\xampp\htdocs\express> npm ls -g --depth 0
C:\Users\USER\AppData\Roaming\npm
+-- bower@1.8.2
+-- browserify@16.1.1
+-- create-react-app@1.5.2
+-- express-generator@4.15.5
+-- gulp@3.9.1
+-- react-tools@0.13.3
`-- undefined@0.1.0
ljharb commented 6 years ago

Your global modules are irrelevant; global modules can't be required or imported.

What's your full package.json? (specifically, dev deps). Where are you getting the error? Can you share the test code that's causing this error? How are you running your tests?

ereztdev commented 6 years ago

I just shared my global packages, since if I missed something there it could be pointed out, but I got you on that. I abandoned this setup and reopened a new one with other dependencies. Thanks @ljharb