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

TypeError: Cannot read property 'request' of undefined #2352

Closed
wiadev opened this issue May 24, 2017 · 11 comments
Closed

TypeError: Cannot read property 'request' of undefined #2352

wiadev opened this issue May 24, 2017 · 11 comments

Comments

@wiadev
Copy link

wiadev commented May 24, 2017

Hi. I 'm having problem running the create-react-app.

Here is the error I've got.
`
TypeError: Cannot read property 'request' of undefined

  • ExternalModuleFactoryPlugin.js:37 handleExternals
    [www-react-client]/[webpack]/lib/ExternalModuleFactoryPlugin.js:37:33

  • ExternalModuleFactoryPlugin.js:46 next
    [www-react-client]/[webpack]/lib/ExternalModuleFactoryPlugin.js:46:8

  • ExternalModuleFactoryPlugin.js:59 handleExternals
    [www-react-client]/[webpack]/lib/ExternalModuleFactoryPlugin.js:59:7

  • ExternalModuleFactoryPlugin.js:79 ExternalModuleFactoryPlugin.
    [www-react-client]/[webpack]/lib/ExternalModuleFactoryPlugin.js:79:5

  • NormalModuleFactory.js:246 applyPluginsAsyncWaterfall
    [www-react-client]/[react-scripts]/[webpack]/lib/NormalModuleFactory.js:246:4

  • Tapable.js:204
    [www-react-client]/[react-scripts]/[tapable]/lib/Tapable.js:204:11

  • IgnorePlugin.js:56 IgnorePlugin.checkIgnore
    [www-react-client]/[react-scripts]/[webpack]/lib/IgnorePlugin.js:56:10

  • Tapable.js:208 NormalModuleFactory.applyPluginsAsyncWaterfall
    [www-react-client]/[react-scripts]/[tapable]/lib/Tapable.js:208:13

  • NormalModuleFactory.js:230 NormalModuleFactory.create
    [www-react-client]/[react-scripts]/[webpack]/lib/NormalModuleFactory.js:230:8

  • Compilation.js:382 Compilation._addModuleChain
    [www-react-client]/[react-scripts]/[webpack]/lib/Compilation.js:382:17

  • Compilation.js:464 Compilation.addEntry
    [www-react-client]/[react-scripts]/[webpack]/lib/Compilation.js:464:8

  • SingleEntryPlugin.js:22 SingleEntryPlugin.
    [www-react-client]/[webpack]/lib/SingleEntryPlugin.js:22:15

  • Tapable.js:229 Compiler.applyPluginsParallel
    [www-react-client]/[react-scripts]/[tapable]/lib/Tapable.js:229:14

  • Compiler.js:488
    [www-react-client]/[react-scripts]/[webpack]/lib/Compiler.js:488:8

  • Tapable.js:131 Compiler.applyPluginsAsyncSeries
    [www-react-client]/[react-scripts]/[tapable]/lib/Tapable.js:131:46

  • Compiler.js:481 Compiler.compile
    [www-react-client]/[react-scripts]/[webpack]/lib/Compiler.js:481:7
    `

Thanks

@danieltott
Copy link

I get this same error - after yarn start I get the following error in the terminal:

(node:88695) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.

Then that is removed and the above error displays in the terminal as well as the console/browser

@danieltott
Copy link

danieltott commented May 24, 2017

OK - found the issue for me. I had a devDependency (an older version of kadira/storybook) that was depending on an old version of webpack 1.4.x - and that was what was being installed, not 2.5.x. I yarn removed the storybook package, yarn install and yarn start worked like a charm.

@FredrikNoren
Copy link

Seems like the order in package.json matters too. Putting storybook last in the dev dependencies seems to fix it for me.

carlbarrdahl added a commit to noto-platform/unamed-event-app that referenced this issue May 31, 2017
@insin insin mentioned this issue Jun 13, 2017
4 tasks
@bvisness
Copy link

bvisness commented Jun 30, 2017

For me, this was caused by an old version of html-webpack-plugin. Running yarn remove html-webpack-plugin and yarn add --dev html-webpack-plugin fixed it for me.

@gaearon
Copy link
Contributor

gaearon commented Jun 30, 2017

Note you shouldn't install any plugins directly if you don't eject.

@sergeyzwezdin
Copy link

@gaearon, is it possible to display more informative error messages instead of "Cannot read property 'request' of undefined"? There is plenty of the time required to find the issue when this happens.

@gaearon
Copy link
Contributor

gaearon commented Jul 3, 2017

How did you get this issue? From my understanding it only happens when you knowingly install tools like Webpack (or rather their incompatible versions) into a projected generated with Create React App. Which has always been unsupported.

Ideally we should do a preflight check and fail early with a meaningful message if we detect that installed Babel, Webpack, Jest etc manually. If you'd like to help implementing this there is an existing issue: #1795.

@NotAmaan
Copy link

NotAmaan commented Jul 5, 2017

I had to run eject to see a more understandable error.

@gaearon
Copy link
Contributor

gaearon commented Jul 5, 2017

If you see this error before ejecting something is wrong. But we can't figure out what if you don't provide a project reproducing this.

@facebook facebook locked and limited conversation to collaborators Jul 5, 2017
@gaearon
Copy link
Contributor

gaearon commented Jul 5, 2017

I'm locking this issue to prevent further drive-by comments.

+1s and "I have this too" are not helpful to diagnose the problem.

If you experience this problem please file a new bug report and fill all the fields including providing a project that reproduces this. You can either try to reproduce it on a new project, or delete as much as possible from your project until you find the bare minimum necessary to reproduce it. For this issue, reports without example projects are not helpful because this is almost certainly a problem with either the package manager you are using, or additional dependencies you installed manually.

@gaearon
Copy link
Contributor

gaearon commented Jan 12, 2018

To be clear, here's how you should generally solve this if you haven't ejected:

  • Delete package-lock.json and yarn.lock if you have them
  • Open your package.json
  • Verify you have react-scripts in it (if you don't, you ejected and this guide doesn't apply)
  • Verify you don't have webpack in it (if you do, remove it)
  • Run yarn (or npm install if you use npm)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants