可以用节点而不是流星启动Meteor App吗?

Ste*_*hlf 5 javascript node.js meteor

如何用node而不是启动流星应用程序meteor.我试过这个:

$ meteor create m;
m: created.

To run your new app:
  cd m
  meteor

$ cd m;

$ meteor;
[[[[[ c:\git\m ]]]]]

=> Started proxy.
=> Started MongoDB.
=> Started your app.

=> App running at: http://localhost:3000/
   Type Control-C twice to stop.

# OK! This works :O)

$ node .meteor\local\build\main.js;
module.js:338
    throw err;
          ^
Error: Cannot find module 'fibers'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (c:\git\m\.meteor\local\build\programs\server\boot.js:1:75)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

$ node .meteor\local\build\main.js;

# OK! This does not work :O(

$ cd .meteor\local\build\;

$ npm install fibers;
$ npm install semver;
$ npm install source-map-support;
$ npm install underscore;

$ node main.js
$ c:\git\m\.meteor\local\build\node_modules\fibers\future.js:267
                                                throw(ex);
                                                      ^
Error: Must pass options.rootUrl or set ROOT_URL in the server environment
    at Object.Meteor.absoluteUrl (packages/meteor/url_common.js:21:1)
    at Object.WebAppInternals.generateBoilerplate (packages/webapp/webapp_server.js:543:1)
    at Object.main (packages/webapp/webapp_server.js:739:1)
    at c:\git\m\.meteor\local\build\programs\server\boot.js:255:27

$ set ROOT_URL=localhost:3000;

$ set ROOT_URL;
ROOT_URL=localhost:3000

$ node main.js
c:\git\m\.meteor\local\build\programs\server\boot.js:263
}).run();
   ^
TypeError: Cannot read property 'slice' of null
    at packages/meteor/url_server.js:11:1
    at c:\git\m\.meteor\local\build\programs\server\packages\meteor.js:1098:4
    at c:\git\m\.meteor\local\build\programs\server\packages\meteor.js:1240:3
    at c:\git\m\.meteor\local\build\programs\server\boot.js:222:10
    at Function._.each._.forEach (c:\git\m\.meteor\local\build\node_modules\underscore\underscore.js:153:9)
    at c:\git\m\.meteor\local\build\programs\server\boot.js:117:5
Run Code Online (Sandbox Code Playgroud)

也许需要更多配置?

Paw*_*łka 1

您可以简单地使用 demeteorizer: DEMETEORiZER ON GITHUB

使用 NPM 安装后,转到您的 Meteor 应用程序目录并使用: demeteorizer --output [path]

然后转到您在 [path] 参数中给出的路径,然后:

npm install
Run Code Online (Sandbox Code Playgroud)

Meteor 应用程序使用以下环境变量:

MONGO_URL='mongodb://user:password@host:port/databasename?autoReconnect=true'
ROOT_URL=' http://example.com '
MAIL_URL='smtp://user :password@mailhost:port/' (可选)
PORT=8080 (可选,默认为 80)

(显然将您的参数放在上面正确的位置)

npm start
Run Code Online (Sandbox Code Playgroud)

我真的推荐这个解决方案。很简单,工作完美且快速。