React-native: Cannot find module './assets/empty-module.js'

Created on 15 Nov 2016  路  9Comments  路  Source: facebook/react-native

Whenever I try to run react-native I get this error:

react-native run-ios
module.js:474
    throw err;
    ^

Error: Cannot find module './assets/empty-module.js'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.resolve (internal/module.js:27:19)
    at Object.<anonymous> (/Users/esen/Github/App/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/ResolutionRequest.js:20:29)
    at Module._compile (module.js:573:32)
    at loader (/Users/esen/Github/App/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/esen/Github/App/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
  • React Native version: 0.37.0
  • Platform: Both
  • Operating System: MacOS
Locked

Most helpful comment

Also ran into this; touch-ing empty-module.js also seems to do the trick:

```
$ (
cd node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/
mkdir -p assets
touch assets/empty-module.js
)

All 9 comments

Uninstalling and reinstalling react-native seems to have fixed the error.

Also ran into this; touch-ing empty-module.js also seems to do the trick:

```
$ (
cd node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/
mkdir -p assets
touch assets/empty-module.js
)

We had the same problem when using yarn. Creating the empty-module.js by hand is just a quickfix which was not an option for our build server.
Thanks to the yarn community it turned out to be a conflict with the .yarnclean file which contained the assets directory.

Deleting the line assets in the .yarnclean solved the problem.

I ran into this when I innadvertantly ran yarn clean. Uninstalling and reinstalling worked - touching the assets/empty-module.js ultimately did not (just ran into more missing files when running my app in the emulator).

Did you check the .yarnclean file which is automatically created when running yarn clean?

Since I didn't intend to run yarn clean I removed .yarnclean and reinstalled the module - sounds like removing assets from .yarnclean would work too.

@dsummersl Thanks very much!

directory doesnt exist >> node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/

@rroehrig Thanks;

delete .yarnclean and reinstall

Was this page helpful?
0 / 5 - 0 ratings