You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vagrant@vagrant-ubuntu-trusty-64:~/nodejs$ node threads.js
[Error: ReferenceError: fibo is not defined]
[ thread-2 ] result: null
[Error: ReferenceError: fibo is not defined]
[ thread-3 ] result: null
[Error: ReferenceError: fibo is not defined]
[ thread-1 ] result: null
For every thread I receive the error [Error: ReferenceError: fibo is not defined] but as we can see I have the function declared as the example and for an experiment, I changed to var fibo = function(n, low, high) { ... } still did not worked.
The text was updated successfully, but these errors were encountered:
require('sleep') is the problem
You can't require external libraries.
The solution is to put all your functions and external libraries in a file, browserify that file and then make a thread.load() of that browserified file.
I have a small file
threads.js
based on this example the content of the file is:When I execute
node threads.js
:vagrant@vagrant-ubuntu-trusty-64:~/nodejs$ node threads.js [Error: ReferenceError: fibo is not defined] [ thread-2 ] result: null [Error: ReferenceError: fibo is not defined] [ thread-3 ] result: null [Error: ReferenceError: fibo is not defined] [ thread-1 ] result: null
For every thread I receive the error
[Error: ReferenceError: fibo is not defined]
but as we can see I have the function declared as the example and for an experiment, I changed tovar fibo = function(n, low, high) { ... }
still did not worked.The text was updated successfully, but these errors were encountered: