react-native: Cannot find module './Module' Error at module.js:487

I really getting stuck while trying to run react-native init AwesomProject on windows 7 the following error is occurring,

image

I have already tried following,

  • yarn : latest
  • node : 6.11.0 and 8.11.3
  • npm : 4 and 5
  • reinstalled react-native-cli
  • restarted pc several time.

One thing is that it was all going perfectly before 1 hour.

Complete Output

` $ react-native init hello3 This will walk you through creating a new React Native project in D:\react\hello 3 Using yarn v0.27.5 Installing react-native… yarn add v0.27.5 info No lockfile found. [1/4] Resolving packages… [2/4] Fetching packages… [3/4] Linking dependencies… warning “react-native@0.46.0” has unmet peer dependency “react@16.0.0-alpha.12”. [4/4] Building fresh packages… success Saved lockfile. success Saved 469 new dependencies. ├─ absolute-path@0.0.0 ├─ accepts@1.2.13 ├─ ajv@4.11.8 ├─ assert-plus@1.0.0 ├─ async@2.5.0 . . . . ├─ yargs-parser@4.2.1 └─ yargs@6.6.0 Done in 53.86s. module.js:487 throw err; ^

Error: Cannot find module ‘./Module’ at Function.Module._resolveFilename (module.js:485:15) at Function.Module._load (module.js:437:25) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at Object.<anonymous> (D:\react\hello3\node_modules\metro-bundler\build\node -haste\DependencyGraph.js:19:16) at Module._compile (module.js:569:30) at Module._extensions…js (module.js:580:10) at Object.require.extensions.(anonymous function) [as .js] (D:\react\hello3\ node_modules\babel-register\lib\node.js:152:7) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12)`

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 17

Most upvoted comments

This helped me Try removing node modules

rm -r node_modules Reinstall node modules by:

npm install

or

yarn install

I solved this issue by doing the following

  1. C: drive -> Users -> “username” eg. john -> AppData -> Roaming

  2. Inside the “Roaming” folder you need to delete both “npm” and “npm-cache” folder.

  3. Now build your project, and it should work