Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/431.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 可以用node而不是Meteor启动Meteor应用程序吗?_Javascript_Node.js_Meteor - Fatal编程技术网

Javascript 可以用node而不是Meteor启动Meteor应用程序吗?

Javascript 可以用node而不是Meteor启动Meteor应用程序吗?,javascript,node.js,meteor,Javascript,Node.js,Meteor,如何使用节点启动Meteor应用程序,而不是使用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://lo

如何使用
节点启动Meteor应用程序,而不是使用
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
$meteor创建m;
m:创建了。
要运行新应用程序,请执行以下操作:
cd m
流星
100万加元;
$meteor;
[c:\git\m][]]
=>已启动代理。
=>启动了MongoDB。
=>启动了你的应用程序。
=>在以下位置运行的应用程序:http://localhost:3000/
输入Control-C两次以停止。
#好的!这是有效的:O)
$node.meteor\local\build\main.js;
module.js:338
犯错误;
^
错误:找不到模块“光纤”
在Function.Module.\u解析文件名(Module.js:336:15)
在Function.Module.\u加载(Module.js:278:25)
at Module.require(Module.js:365:17)
根据需要(module.js:384:17)
反对。(c:\git\m\.meteor\local\build\programs\server\boot.js:1:75)
在模块处编译(Module.js:460:26)
在Object.Module.\u extensions..js(Module.js:478:10)
在Module.load(Module.js:355:32)
在Function.Module.\u加载(Module.js:310:12)
at Module.require(Module.js:365:17)
$node.meteor\local\build\main.js;
#好的!这不起作用:哦(
$cd.meteor\local\build\;
$npm安装光纤;
$npm安装semver;
$npm安装源地图支持;
$npm安装下划线;
$node main.js
$c:\git\m\.meteor\local\build\node\u modules\fibers\future.js:267
投掷(ex);
^
错误:必须在服务器环境中传递options.rootUrl或设置ROOT\u URL
在Object.Meteor.absoluteUrl(packages/Meteor/url_common.js:21:1)
位于Object.WebAppInternals.generatebilerplate(packages/webapp/webapp_server.js:543:1)
在Object.main(packages/webapp/webapp_server.js:739:1)
在c:\git\m\.meteor\local\build\programs\server\boot.js:255:27
$set ROOT\u URL=localhost:3000;
$set ROOT\u URL;
ROOT\u URL=localhost:3000
$node main.js
c:\git\m\.meteor\local\build\programs\server\boot.js:263
}).run();
^
TypeError:无法读取null的属性“slice”
在packages/meteor/url_server.js:11:1
在c:\git\m\.meteor\local\build\programs\server\packages\meteor.js:1098:4
在c:\git\m\.meteor\local\build\programs\server\packages\meteor.js:1240:3
在c:\git\m\.meteor\local\build\programs\server\boot.js:222:10
at Function.each.forEach(c:\git\m\.meteor\local\build\node\u modules\下划线\下划线.js:153:9)
在c:\git\m\.meteor\local\build\programs\server\boot.js:117:5

可能需要更多配置?

您只需使用demeteorizer即可:

使用NPM安装后,请转到meteor应用程序目录,并使用以下方法: demeteorizer—输出[路径]

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

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

蒙哥乌mongodb://user:password@主机:端口/数据库名?autoReconnect=true'
根URL=''
邮件地址:smtp://user:password@邮件主机:端口/'(可选)
端口=8080(可选,默认为80)

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


我真的推荐这种解决方案。简单、完美且快速。

在应用程序捆绑后,在生产环境中运行meteor应用程序时,使用node启动该应用程序是正常的。这就是你感兴趣的吗?是的,我知道,但启动应用程序时尽可能干燥会很好吗?意味着尽可能少的后处理和预处理。我们正在试验调试。所以接近开发的状态是完美的。每次启动meteor时,它都会启动node.js来运行它。这是包装问题。有关详细信息,请参见答案
npm start