Search code examples
reactjscreate-react-appnpx

REACT Error: Cannot find module 'core-util-is'


I´m stuck creating an react app. I have tried npx create-react-app my app, but it doesn´t work. Now I get this "Cannot find module 'core-utils-is', previously I fixed another problem with another module. So, that I suspect that I am in a bug. I think the best solution is to start from cero. But I´m not sure how can I uninstall an reinstall all that I need without breaking all (nodejs, npm...). I enclose the image of my console: enter image description here

$ npx create-react-app my-app internal/modules/cjs/loader.js:883
throw err; ^

Error: Cannot find module 'core-util-is' Require stack:

  • C:\Users\ILC\node_modules\hyperquest\node_modules\readable-stream\lib_stream_duplex.js
  • C:\Users\ILC\node_modules\hyperquest\node_modules\readable-stream\lib_stream_transform.js
  • C:\Users\ILC\node_modules\hyperquest\node_modules\readable-stream\transform.js
  • C:\Users\ILC\node_modules\hyperquest\node_modules\through2\through2.js
  • C:\Users\ILC\node_modules\hyperquest\index.js
  • C:\Users\ILC\node_modules\create-react-app\createReactApp.js
  • C:\Users\ILC\node_modules\create-react-app\index.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Function.Module._load (internal/modules/cjs/loader.js:725:27) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object. (C:\Users\ILC\node_modules\hyperquest\node_modules\readable-stream\lib_stream_duplex.js:39:12) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\ILC\node_modules\hyperquest\node_modules\readable-stream\lib\_stream_duplex.js', 'C:\Users\ILC\node_modules\hyperquest\node_modules\readable-stream\lib\_stream_transform.js', 'C:\Users\ILC\node_modules\hyperquest\node_modules\readable-stream\transform.js', 'C:\Users\ILC\node_modules\hyperquest\node_modules\through2\through2.js', 'C:\Users\ILC\node_modules\hyperquest\index.js', 'C:\Users\ILC\node_modules\create-react-app\createReactApp.js', 'C:\Users\ILC\node_modules\create-react-app\index.js' ] } Thank you

Solution

  • You can try to update npm with npm update and see if that fixes it, and if not you can try these steps.

    If you've previously installed create-react-app globally via npm install -g create-react-app, it is recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

    You may also want to cd into a directory that you want to host your programs. I tend to put all my programs into a folder in c:\Users\<Username>\Documents\github. It looks like your node_modules is trying to install directly to your user home directory.

    Once you are in the directory of choice to build your app and you have removed the global installations you can try running these commands.
    npx create-react-app my-app
    cd my-app
    npm start

    Create React App - Getting Started

    Edit: If that works for you, then you may also want to go back to C:\Users\ILC and remove your node_modules folder and any other remnant files such as package.json that don't belong in that folder.