Published on

[Solved] Error: Cannot find module '...' node:internal/modules/cjs/loader:936

Problem

Running into the following error when trying to run a React application with npm start:

$ npm start

> frontend@0.1.0 start
> react-scripts start

'ReactJSExampleApps\node-react-ecommerce\frontend\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'C:\Users\sheha\OneDrive\Documents\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Solution:

There are a number of possible causes for this problem, but in my case it was because the parent directory containing my React app was named in the format Next&ReactApps. The presence of the & caused npm to not be able to navigate into the React app's root directory and therefore was throwing these Cannot find module errors. To fix this, make sure to remove the & from the names of any directories in the path to your React applications.

Conclusion

Well this is the end of the article, if you have any questions or concerns please feel free to post a comment in this article and I will get back to you if I find the time.

I hope you found this article helpful. Thanks so much for reading my article! Feel free to follow me on Twitter and GitHub, connect with me on LinkedIn and subscribe to my YouTube channel.