I am trying to run a react-native project on android emulator, but before I can get it to run properly, I need to run this command:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
I got this command from this question, as I was having the problem described there. This worked yesterday, but I created a new project this morning, and now running the command hits an error with the following stack trace:
Error: Cannot find module 'jest-serializer'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at _load_jestSerializer (/Users/jareddembrun/Documents/Rot3/ReactNative/MyTechLoungeReactNativeMobileApp/node_modules/jest-haste-map/build/index.js:164:52)
at HasteMap._persist (/Users/jareddembrun/Documents/Rot3/ReactNative/MyTechLoungeReactNativeMobileApp/node_modules/jest-haste-map/build/index.js:781:25)
at _buildPromise._buildFileMap.then.then.hasteMap (/Users/jareddembrun/Documents/Rot3/ReactNative/MyTechLoungeReactNativeMobileApp/node_modules/jest-haste-map/build/index.js:425:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
I ran npm install -g jest-serializer
and got back
+ jest-serializer@23.0.1
updated 1 package in 0.498s
So the module must exist on my machine. Why is react-native bundle having trouble finding it?
Edit
Installing the jest-serializer
locally fixed the problem, but why can't the react-native bundle script find the package if it's installed globally