DAB0mB/ReactNativeMeteorBoilerplate

Cannot find module 'Dimensions'

Closed this issue · 7 comments

I have cloned this repo and I can't start Meteor.

Environment

Environment:
  OS: macOS High Sierra 10.13.4
  Node: 8.11.3
  Yarn: 1.9.2
  npm: 5.6.0
  Watchman: 4.9.0
  Xcode: Xcode 9.4 Build version 9F1027a
  Android Studio: 3.1 AI-173.4720617

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: ~0.55.2 => 0.55.4

Reproduction Steps

git clone git@github.com:DAB0mB/ReactNativeMeteorBoilerplate.git
cd ReactNativeMeteorBoilerplate
yarn api
W20180802-11:28:31.412(-4)? (STDERR) Error: Cannot find module 'Dimensions'
W20180802-11:28:31.412(-4)? (STDERR)     at Function.Module._resolveFilename (module.js:547:15)
W20180802-11:28:31.412(-4)? (STDERR)     at Function.Module._load (module.js:474:25)
W20180802-11:28:31.412(-4)? (STDERR)     at Module.require (module.js:596:17)
W20180802-11:28:31.413(-4)? (STDERR)     at require (internal/module.js:11:18)
W20180802-11:28:31.413(-4)? (STDERR)     at Object.get Dimensions [as Dimensions] (/Users/nicolascharpentier/Projects/GitHub/DAB0mB/ReactNativeMeteorBoilerplate/node_modules/react-native/Libraries/react-native/react-native-implementation.js:78:29)
W20180802-11:28:31.413(-4)? (STDERR)     at Object.<anonymous> (/Users/nicolascharpentier/Projects/GitHub/DAB0mB/ReactNativeMeteorBoilerplate/node_modules/react-native-browser-polyfills/index.js:9:5)
W20180802-11:28:31.413(-4)? (STDERR)     at Module._compile (module.js:652:30)
W20180802-11:28:31.413(-4)? (STDERR)     at Object.Module._extensions..js (module.js:663:10)
W20180802-11:28:31.414(-4)? (STDERR)     at Module.load (module.js:565:32)
W20180802-11:28:31.414(-4)? (STDERR)     at tryModuleLoad (module.js:505:12)
W20180802-11:28:31.414(-4)? (STDERR)     at Function.Module._load (module.js:497:3)
W20180802-11:28:31.414(-4)? (STDERR)     at Module.require (module.js:596:17)
W20180802-11:28:31.414(-4)? (STDERR)     at require (internal/module.js:11:18)
W20180802-11:28:31.414(-4)? (STDERR)     at Object.<anonymous> (/Users/nicolascharpentier/Projects/GitHub/DAB0mB/ReactNativeMeteorBoilerplate/node_modules/react-native-meteor-polyfills/client.js:1:1)
W20180802-11:28:31.414(-4)? (STDERR)     at Module._compile (module.js:652:30)
W20180802-11:28:31.415(-4)? (STDERR)     at Object.Module._extensions..js (module.js:663:10)
=> Exited with code: 1

It looks like it can load modules from react native package here:
https://github.com/ardatan/react-native-browser-polyfills/blob/35d535855df3f9095aa7494ea7e6adb96652eb15/index.js#L1-L9

Same on Linux.

If you aren't going to use Facebook and Twitter login, you can just remove the polyfills' import part in Meteor project.
Just change server/index.js

import { setApplicationPrefix} from 'react-native-meteor-polyfills'

to

import { setApplicationPrefix} from 'react-native-meteor-polyfills/server'

In this case:

W20180804-09:12:01.504(2)? (STDERR) /home/palpinter/.meteor/packages/promise/.0.11.1.2dt0ep.qrr9k++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/promise_server.js:218
W20180804-09:12:01.504(2)? (STDERR)       throw error;
W20180804-09:12:01.505(2)? (STDERR)       ^
W20180804-09:12:01.505(2)? (STDERR) 
W20180804-09:12:01.505(2)? (STDERR) TypeError: Cannot destructure property `OAuth` of 'undefined' or 'null'.
W20180804-09:12:01.505(2)? (STDERR)     at Object.<anonymous> (/home/palpinter/Fejlesztés/militia/ReactNativeMeteorBoilerplate/node_modules/react-native-meteor-polyfills/server.js:3:12)
W20180804-09:12:01.505(2)? (STDERR)     at Module._compile (module.js:652:30)
W20180804-09:12:01.506(2)? (STDERR)     at Object.Module._extensions..js (module.js:663:10)
W20180804-09:12:01.506(2)? (STDERR)     at Module.load (module.js:565:32)
W20180804-09:12:01.506(2)? (STDERR)     at tryModuleLoad (module.js:505:12)
W20180804-09:12:01.506(2)? (STDERR)     at Function.Module._load (module.js:497:3)
W20180804-09:12:01.506(2)? (STDERR)     at Module.require (module.js:596:17)
W20180804-09:12:01.507(2)? (STDERR)     at require (internal/module.js:11:18)
W20180804-09:12:01.507(2)? (STDERR)     at npmRequire (/home/palpinter/Fejlesztés/militia/ReactNativeMeteorBoilerplate/api/.meteor/local/build/programs/server/npm-require.js:133:10)
W20180804-09:12:01.507(2)? (STDERR)     at Module.useNode (packages/modules-runtime.js:650:18)
W20180804-09:12:01.507(2)? (STDERR)     at server.js (packages/modules.js:204:8)
W20180804-09:12:01.507(2)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:322:7)
W20180804-09:12:01.508(2)? (STDERR)     at Module.require (packages/modules-runtime.js:224:14)
W20180804-09:12:01.508(2)? (STDERR)     at require (packages/modules-runtime.js:244:21)
W20180804-09:12:01.508(2)? (STDERR)     at main.js (server/main.js:1:205)
W20180804-09:12:01.508(2)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:322:7)
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.

@pal-pinter
If you aren't going to use Facebook and Twitter login, you need to remove the polyfills' import part in Meteor project (which I'm going to fix this in a PR)
https://github.com/ardatan/ReactNativeMeteorBoilerplate
Or you need to add accounts-facebook or accounts-twitter to make it work, because it modifies some parts in the OAuth package.

OK, thanks.

So is it working now?

Yes, thank you! But I have another problem with meteor-client-bundler. I've received 'unknown document' error on ios device... But I investigating...