我正在尝试制作(我不知道它叫什么,热加载?热重载?)类似 Meteor 的数据实时加载,但是使用的是 Node.js 而不是 Meteor。
我正在使用 ddp客户端模块(=浏览器,我还没有尝试过)和 ddp-reactive-server ,好吧,对于服务器来说。
server.js
是这样的:
var DDPServer = require('ddp-server-reactive');
var server = new DDPServer();
var todoList = server.publish('todolist');
之后,我使用命令 node server.js --harmony_proxies
运行服务器(注意我已经在使用该标志),这就是我得到的:
[aseds@localhost ~]$ node server.js --harmony_proxies
/home/aseds/Desktop/projeh/css-goodness/node_modules/harmony-reflect/reflect.js:2049
throw new Error("proxies not supported on this platform. On v8/node/iojs, make sure to pass the --harmony_proxies flag");
^
Error: proxies not supported on this platform. On v8/node/iojs, make sure to pass the --harmony_proxies flag
at global.Proxy (/home/aseds/Desktop/projeh/css-goodness/node_modules/harmony-reflect/reflect.js:2049:13)
at publish (/home/aseds/Desktop/projeh/css-goodness/node_modules/ddp-server-reactive/lib.js:211:32)
at Object.<anonymous> (/home/aseds/Desktop/projeh/css-goodness/ddpserver.js:10:23)
at Module._compile (module.js:397:26)
at Object.Module._extensions..js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:429:10)
at startup (node.js:139:18)
at node.js:999:3
我的nodejs版本v5.4.1。 我什至不确定是否真的可以通过这种方式实现 Meteor 的自动重新加载功能,但我正在尝试! :)
预先感谢您提供的任何帮助。
最佳答案
我遇到了这个关于 --harmony-proxies 的帖子:
https://github.com/tvcutsem/harmony-reflect/issues/56
相关位:
I released version 1.4.0 which, when loaded twice according to the script outlined above, loads correctly.
Note that loading v1.3.1 of this library followed by v1.4.0 will still fail (the other way around works fine). So it's important that your dependencies upgrade to the latest version.
如果 Harmony-proxies 作为 Node 依赖项加载两次,需要不同的版本,并且首先加载 1.4.0 之前的版本,那么您将看到此错误。
关于node.js - 该平台不支持代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34844996/