Meteor leaderboard app on node-webkit
Asked Answered
K

1

2

I am trying to get the meteor leaderboard app to run on Node-Webkit. I have demeteorized it and compressed it to a .nw file but when I drop it in. I get errors:

Invalid Package There is no 'package.json' in the package, please make sure the 'package.json' is in the root of the package.

I have read on various thread but nothing clear yet. It seems like the demeteorized app needs to be restructured. Also need to figure out how to run the server [Locally/DDP].

Edited:

P.S. I am using the demeteorized files from the leaderboard meteor app to be able to run it in node-webkit.

What exactly I am trying to figure out here is :

  1. how to run/init the local node(demeteorized) server and set the port.

  2. How to set environment variables for the demeteorized app for mongodb etc.

  3. What would be used as the

"main": ?,
"node-remote": ?

for the node-webkit package.json file.

Can someone please shed some light and if possible an example will be highly appreciated.

Thanks in advanced.

Praney :)

UPDATE:

After tinkering a bit, I added the "main": "index.html" and added index.html file to the root of the demeteorized app. This file just loads the main.js file in the browser, here:

<!DOCTYPE html>
<html>
  <head>
    <title>Leaderboards</title>
  </head>
  <body>
  </body>
  <script src="main.js" type="text/javascript"></script>
</html>

Now I am getting this error:

"Uncaught ReferenceError: __dirname is not defined", source: file:///Users/Praney/projects/webkit/nw-sample-apps/leaderboards/main.js(2)

main.js

process.argv.splice(2, 0, 'program.json');
process.chdir(require('path').join(__dirname, 'programs', 'server'));
require('./programs/server/boot.js');
Keverne answered 22/8, 2014 at 6:52 Comment(0)
T
0

This isn't how demeteorizer is meant to be used.. exactly/kind of.

You would use the output bundle on your deployed server to run as your meteor app, not put it in an existing meteor app.

The package.json that you get from it is slightly different to the one that meteor-npm would use.

When you've finished your meteor app you would use demeteorizer to create an easy bundle that can run on your server. If you uploaded it and untarred it:

  1. You would install the npm modules by cding into the bundle and running npm install
  2. You can run the app as normal as described in the docs.

The whole purpose of demeteorizer is to nodify your app, you wouldn't need to this on the platform you made it since all the npm modules would already be working. The problem it solves is usually with cross-archs, e.g if you made your app on OS X and it uses binary npm modules and the server uses Ubuntu (not os x)

I suppose node-webkit could also do it, you would need to use the root directory of demeteorize for this (seperate from your app). You can see there's a package.json already in it, perhaps the root directory you set it to use is that of your meteor app and not the untarred output of the demeteorized app?

Telefilm answered 22/8, 2014 at 10:42 Comment(2)
Thanks for the reply @akshat but that was just to show the contents of the demeterized app. I am aware that it needs to run independently and not within the meteor app. Yes I was trying to run the untarred output of the demeteorized app in node-webkit.Keverne
it seemed my question and the image caused a bit of confusion. I apologise for it. I have just update my question with more details. Thanks for your time mate :)Keverne

© 2022 - 2024 — McMap. All rights reserved.