I never normally post stuff here asking why something isn't working, but i've been struggling all day with this issue and hope that someone might be familiar with what's happening and could help.
I took an example from github on how to control GPIOs on the beaglebone black over wi-fi by using socket.io : github.com/lgxlogic/BoneScript-SocketIO
I'm not an expert with javascript but when I follow the exact instructions given and and run the HtmlLedDemo.js file, I get the following error below. My version of node is v.5.9.0 . I have tried updating socket.io and still the same problem. Many thanks in advance.
root#beaglebone:/var/lib/cloud9# node HtmlLedDemo.js
Option log level is not valid. Please refer to the README.
Option browser client minification is not valid. Please refer to the README.
Option browser client etag is not valid. Please refer to the README.
Server running on: http://192.168.0.87:8080
/var/lib/cloud9/node_modules/bonescript/src/my.js:245
callback(resp);
^
TypeError: callback is not a function
at onUnloadSlot (/var/lib/cloud9/node_modules/bonescript/src/my.js:245:13)
at unloadSlot (/var/lib/cloud9/node_modules/bonescript/src/my.js:235:13)
at onWriteSlots (/var/lib/cloud9/node_modules/bonescript/src/my.js:210:43)
at onReadSlots (/var/lib/cloud9/node_modules/bonescript/src/my.js:199:13)
at onFindCapeMgr (/var/lib/cloud9/node_modules/bonescript/src/my.js:174:9)
at Object.exports.load_dt (/var/lib/cloud9/node_modules/bonescript/src/my.js:157:5)
at onDTBOExists (/var/lib/cloud9/node_modules/bonescript/src/my.js:332:26)
at onDTBOExistsTest (/var/lib/cloud9/node_modules/bonescript/src/my.js:279:13)
at Object.exports.create_dt (/var/lib/cloud9/node_modules/bonescript/src/my.js:274:9)
at Object.exports.setPinMode (/var/lib/cloud9/node_modules/bonescript/src/hw_capemgr.js:102:12)
root#beaglebone:/var/lib/cloud9#
Your error message says "callback is not a function". If you have a look at the supplied call stack, you can see that on line 245 of your "my.js" file, you attempt to call a function by the variable name callback. What this error message tells you is that whatever this variable contains, it is not a function.
Related
this is my first time posting here and i am not really experienced in Node.js, but i found this kind of abandonned script on github which i needed for it. Basically what it should do is check for availability of a custom SteamID, and once its available it should claim it. It opens, but once the id is free i get this following error:
community.editProfile({
^
TypeError: community.editProfile is not a function
at setClaim (C:\Users\sam1e\Desktop\steam-turbo-master\terbowe.js:89:11)
The repo link is: https://github.com/wtfwtfwtf111/steam-turbo if anyone needs to take a look at it.
Thanks! :)
I'm giving a try with [react-native-crypto][1] in order to learn how to convert nodejs to be used in React Native project in the future. Unfortunately, I couldn't get it running successfully. I've faced an issue with stream is undefined. ERROR TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[0], "stream").Transform.call').
If you have ever faced a similar problem, I'm so grateful for your help.
Also, I attach the screenshot of the issue as the following
For anyone still trying to solve this issue, I have figured out a solution that worked for me. So within node_modules/cipher-base/index.js, the top of the file should have a line which defines the variable Transform as var Transform = require('stream').Transform. For some reason, it does not like the module stream and as such it needs to be changed to readable-stream. Therefore the variable Transform should now read var Transform = require('readable-stream').Transform.
From what I have gathered, the stream module it is trying to refer to isnt actually a module that can be used. The reason why it gets referenced however seems to be because the tsconfig.json file in the root directory specifies "stream": ["./node_modules/readable-stream"] as a path, almost as if to make stream refer to the readable-stream module, which in theory it should refer to when it is called. But in this case it doesnt happen so we need to explicitly define that we are refering to the readable-stream module.
Hope this helps anyone else out there and prevents others scratching their heads for hours on end like it did for me!
I have figured it out by editing in metro.config.js as the following:
resolver: {
extraNodeModules: {
stream: require.resolve('stream-browserify'),
}
},
I am writing a client side code in Visual C++ 2012 using C++ Rest SDK (codename "Casablanca").
I have a client created and wish to POST a text string to the server. However, when I send the following code, it is compiling but not sending sending the request.
When I remove everything after "methods::POST" and send a blank post request, then it is sent and received by the server.
Can you please guide me where the problem is. The documentation related to this function is available on Casablanca Documentation.
pplx::task<http_response>resp = client.request(methods::POST,L"",L"This is the random text that I wish to send", L"text/plain");
I think the usage you give here looks correct.
Is your Casablanca the latest version ? Please check that out from here : http://casablanca.codeplex.com/
If you are sure your measurement is accurate, you may want to create a minimal repro and file a bug here : http://casablanca.codeplex.com/workitem/list/basic
I was having a similar problem, all my POSTs was arriving in blank on server , after a few hours work above it, i found a possible solution.
I changed the default content type to application/x-www-form-urlencoded and I started to pass the values like this Example data=text1&data2=text2
client.request(methods::POST,L"",L"data=text1&data2=text2", L"application/x-www-form-urlencoded");
The body parameter must be a json::value.
I cannot comment yet so I have to put my thoughts in an answer. I solved this problem like this: There is an overload of the request method that takes as a parameter the content type so that you do not have to change the code.
m_client->request(methods::POST, L"/statuses/update.json?" + url_encode(data),L"",L"application/x-www-form-urlencoded");
Obviously you would have to implement the url_encode method but that is not difficult. There is a pretty good implementation in "Cassablanca". A search on this site will alos turn up some good examples.
This is the line that causes trouble. It's node.js + socket.io on the backend and it shows an error in NetBeans. It sends the message from the server, but the handle comes up undefined.
io.sockets.in(socket._chatroom).emit('broadcast_message', {message: message, handle: socket._handle});
Any suggestions?
Thank you :)
Change your code so that it takes multiple lines. You'll have an easier time figuring out which . operator netbeans is talking about.
If I reload my application (from the browser with the reload button) a lots of times like 50 reload/10 seconds it gives me this error:
events.js:45
throw arguments[1]; // Unhandled 'error' event
^
Error: EBADF, Bad file descriptor
This seems to me like a bandwidth error or something like that, originally I've got the error when I played with the HTML 5 Audio API, and If I loaded the audio file 10-15 times sequentially then I've got the error, but now I've discovered that I get the error without the Audio API too just by reloading the site a lots of times, also Safari gives me the error much faster than Chrome (WTF?)
I'm using Node.js 0.4.8 with express + jade and I'm also connected to a MySQL database with the db-mysql module.
I can't find any articles on the web about this topic what helps, so pleeease let me know what can cause this error because it's really confusing :(
By "reload your application" do you mean refresh your app's home page from a browser, or actually stop and restart the node.js server process? I assume the former, in which case if you can't reliably reproduce this it will be pretty tricky to debug, especially since you don't have a good stack trace to pinpoint the source. But if you use the express.js app.error hook (docs here) you'll want to log the error path from the "Bad file descriptor" error, which should hopefully clue you in to whether this is a temporary file that got deleted or what. In terms of the actual cause, we can only offer guesses since "Bad file descriptor" is a very generic low level error that basically means you are calling an operation on a file descriptor that is no longer in the correct state to handle that operation (like reading a closed file, opening a file that has been deleted, etc).
#CIRK, take a look at this: https://github.com/joyent/node/issues/1189
it's not a node problem, but a system tuning issue.
edit: or maybe it's related to this error in connect 1.4.3:
https://github.com/senchalabs/connect/issues/297
if this is your case, just try to upgrade it
This error may result from using fs to save a file whose name is a number rather than a string. File names must be strings:
Incorrect:
const fileName = 12345;
const fileContent = "The great croissant."
fs.writeFileSync(fileName, fileContent);
Correct:
fs.writeFileSync(`${fileName}`, fileContent);
Also correct:
const fileName = "12345";
fs.writeFileSync(fileName, fileContent);