Meteor leaderboard app on node-webkit

纵然是瞬间 提交于 2019-12-06 11:27:42

问题


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');

回答1:


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?



来源:https://stackoverflow.com/questions/25441168/meteor-leaderboard-app-on-node-webkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!