3

I am looking to test out the new beta Onsen UI 2 in Meteor. I tried creating a package using meteorhack and browserify.

https://onsen.io/2/

The steps I followed are:

add meteorhacks and browserify

meteor add meteorhacks:npm cosmos:browserify add onsenui to packages.json

{
   "onsenui" : "2.0.0-beta"
}

Add it to lib/app.browserify.js

 OnsenUi = require('onsenui/js/onsenui');

I then try running the application but just keep hitting the same issue.

W20160325-14:40:26.163(2)? (STDERR)                         throw(ex);
W20160325-14:40:26.163(2)? (STDERR)                               ^
W20160325-14:40:26.340(2)? (STDERR) ReferenceError: window is not defined
W20160325-14:40:26.340(2)? (STDERR)     at defineProperty (node_modules/onsenui/js/onsenui.js:6:1)
W20160325-14:40:26.340(2)? (STDERR)     at Object.<anonymous> (node_modules/onsenui/js/onsenui.js:175:1)
W20160325-14:40:26.340(2)? (STDERR)     at Object._process (node_modules/onsenui/js/onsenui.js:19919:1)
W20160325-14:40:26.340(2)? (STDERR)     at s (../../../../../../../.meteor/packages/cosmos_browserify/.0.10.0.1e53wt8++os+web.browser+web.cordova/plugin.CosmosBrowserify.os/npm/CosmosBrowserify/node_modules/browserify/node_modules/browser-pack/_prelude.js:1:1)

I was thinking that as this new version is React compatible and no longer requires Angular that this should be possible?

Andi Pavllo
  • 2,506
  • 4
  • 18
  • 30
Finglish
  • 9,692
  • 14
  • 70
  • 114

1 Answers1

0

The combination of meteorhacks and browserify never worked very well for me. Try using Meteor 1.3, it supports npm out of the box. Updating to 1.3 solved the problem for me when I was trying to use Material-UI for a meteor project.

You can upgrade to meteor 1.3 using the following command. (Make sure to back-up your project first)

meteor remove meteorhacks and browserify
meteor update --release 1.3-rc.12
npm install onsenui@2.0.0-beta --save

They try to run meteor again.

Finglish
  • 9,692
  • 14
  • 70
  • 114
C.Lee
  • 10,451
  • 9
  • 31
  • 46
  • Upgrading to 1.3 for better NPM support sounds like a good idea, but I am having issues running the upgraded app on the ios simulator. The build is successful, and even with --verbose I can not see any errors, but the app gets stuck on the splash screen. I have even tried creating a new project with just the standard test data and running that in the simulator. Again, 1.2 runs fine but 1.3 get stuck on the splash screen. I am hunting around the Meteor forums to see if anyone knows why. – Finglish Mar 25 '16 at 18:25
  • 2
    Just as a note - its a bit stupid but - after upgrading i needed to run ios-device the first time and then run the simulator from Xcode. After that that I can use meteor run ios as before. – Finglish Mar 27 '16 at 14:21
  • Good job figuring that out. Sorry that I couldn't help you with this since I haven't used Meteor for mobile development. – C.Lee Mar 28 '16 at 12:16