问题标签 [node-fibers]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
meteor - _meteor_bootstrap_.require 在 Meteor 0.6.4.1 中不工作
我继承的代码使用 _meteor_bootstrap.require(一个内部流星详细信息)来加载模块。看起来它不再适用于 0.6.4.1?关于我应该如何加载模块的任何建议?
当前代码 require = meteor_bootstrap.require
未来 = require (fibers/future)
我收到的错误消息:C:\Program Files (x86)\Meteor\lib\node_modules\fibers\future.js:173
throw(ex);
^
TypeError: undefined is not a function
at app/server/main.coffee.js:7:10
at C:\Users\jhuang\Documents\Tervela\5.0.16\i32\lib.meteor\local\build\server\ server.js:306:12
at Array.forEach (native)
at Function。。每个。.forEach (C:\Program Files (x86)\Meteor\lib\node_modules\underscore\underscore.js:78:11)
在运行时 (C:\Users\jhuang\Documents\Tervela\5.0.16\i32\lib. meteor\local\build\server\server.js:239:7)
=> 退出代码:1
=> 您的应用程序正在崩溃。等待文件更改。
node.js - 节点光纤可以使用 ES6 生成器实现吗?
Wikipedia 建议可以使用生成器来实现协程。这是否意味着可以使用ES6 生成器来实现节点光纤?
meteor - 来自 setTimeout 回调的异常:{ stack: [Getter] } 和 Mongo 错误
我收到以下异常:
请指教,是什么原因造成的问题?
我在 0.6.5 流星,0.6.6 地铁,0.10.13 节点和 1.3.2 npm。
顺便说一句,应用程序本身工作正常:)
请指教。
谢谢,
阿列克谢
javascript - 如何在 Node.js 中让纤维等待?
我是 Node.js 的新手,并意识到它与客户端 javascript 的最大区别之一是一切都是异步的。
为了尝试解决这个问题,我尝试使用fibrous将我的代码转换为更具功能性的编程风格,但遇到了一些问题:
如何使以下纤维代码起作用?
例如,我希望下面的代码打印 1,2,3,但它打印 1,3,2
在一个真实的用例中,上面的例程将包装一个运行异步的 DB 方法,并使其如此我可以编写如下内容:
macos - npm fails to install fibers "Build succeeded but target not found", weird error 1
I recently updated node.js on my Mac OSX 10.8.5 by uninstalling my old version and reinstalling through Homebrew. I am now getting errors installing fibers.
npm version gives me:
When I run
I get
I get similar errors without the @1.0.1 and with a '-g' flag. Any suggestions?
asynchronous - 编写/转换 Meteor 同步函数
这一直困扰着我一段时间,所以我想我只需对其进行快速 QA:
如果一个人有一个普通的 nodeJS 模块或其他东西,并且它在服务器端有一个异步功能。我如何使它同步。例如,我如何将 nodejsfs.stat
异步函数转换为同步函数。
例如我有
服务器端js
如果我从客户端调用它,我会返回undefined
结果,因为结果在回调中。
node.js - 从 Fibers(nodejs) 内部返回一个值
所以我在尝试从这个模块的构造函数返回一个值时遇到了麻烦。我真的不知道如何将值返回给构造函数。
我希望代码是不言自明的,我希望构造函数返回散列变量。
node.js - 节点光纤会破坏节点域吗?
我目前正在使用节点光纤来编写同步服务器端代码。我主要通过 try-catch 块进行错误处理,但在外部库或其他少量异步代码中总是有可能发生错误。我正在考虑使用新的域功能尝试将这些错误路由到正确的请求,我想知道是否有人尝试在同一个应用程序中使用纤程和域。
根据域在幕后的工作方式,我可以想象纤程可能会破坏一些用于将异步代码与正确域相关联的假设。具体来说,我担心域可能会执行以下操作来跟踪上下文,这可能会与纤程中断,因为纤程破坏了函数将在任何其他代码运行之前运行完成的保证:
有没有人成功或不成功地尝试让光纤和域一起玩?
node.js - Tracking down stack overflow in meteor/node fiber
I'm seeing this crash now and am not familiar enough with the node fiber infrastructure to know where to begin interpreting the error or instrumenting the code...
As I understand it, something is recurring a little too enthusiastically, the server stack blows up, and it crashes. Unfortunately, I have no real idea where this offending function is--I looked at the my Deps.autorun call (just one at the moment) and it does not seem to be the trouble. None of my code is implemented with explicit recursion, and I don't have any reason to suspect large objects are being passed around. Obviously, I'm not really sure, of course.
I'm really just looking for advice on how to instrument the code to show me where things are getting out of hand. Since Meteor's doing a whole lot behind the scenes, it would be really useful if anyone could give me a few pointers as to where to look.
Just coming back to this, and am still pretty lost as to where to be looking. this suggested updating to node 0.11.x would give me more info, but doing that doesn't seem to have added any more detail when it crashes.
The crash happens after any page interaction--that is, the server starts up and is functioning ok, but if I reload in the browser or interact with the page itself, BOOM!
By popular demand, here is the server code:
uncommenting line 172 of future.js did not provide more details:
And, here's the trouble I run into while trying to use node-inspector. I have been playing with this for the past half hour, so I'm likely just making some fundamental error, but: I installed node-inspector via npm (npm install -g node-inspector).
then, I try
so far, so good. At this point, the client side is not open in my browser (i.e. no tab pointing at localhost:3000). I open up a Chrome tab pointing to localhost:5858, and see the source for meteor.js I set a breakpoint on line 6 of meteor.js
and then open the meteor client tab (localhost:3000) and the aforementioned stack overflow pops up again. The debugger does not halt on line 6, or in any other way indicate that it has noticed. Same is true if I set a breakpoint at line 3.
node.js - Meteor 和 Fibers/bindEnvironment() 是怎么回事?
我在使用 Fibers/Meteor.bindEnvironment() 时遇到了困难。如果集合开始为空,我尝试更新代码并将其插入集合。这一切都应该在启动时在服务器端运行。
我第一次写这篇文章时,我遇到了错误,我需要将我的回调包装在 Fiber() 块中,然后在 IRC 的讨论中有人建议尝试 Meteor.bindEnvironment(),因为那应该将它放在 Fiber 中。那没有用(我看到的唯一输出是inserting...
,这意味着 bindEnvironment() 没有抛出错误,但它也没有运行块内的任何代码)。然后我到了这个。我现在的错误是:Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
我是 Node 新手,并不完全理解 Fibers 的概念。我的理解是,它们类似于 C/C++ 中的线程/每种语言中的线程,但我不明白扩展到我的服务器端代码的含义是什么/为什么我的代码在尝试插入时抛出错误一个集合。谁能给我解释一下?
谢谢你。