Not able to test node.js first demo program. Run throws error

75 views
Skip to first unread message

jennifer Dsilva

unread,
Jun 30, 2020, 11:35:08 PM6/30/20
to BeagleBoard
Not able to test node.js first demo program. Run throws error

I am getting below error when I have executed the first demo program:

Bonescript: initialized

Exception: TypeError: require is not a function

Bonescript: initialized

How to solve this?

Thanks

jonnymo

unread,
Jul 1, 2020, 12:46:33 AM7/1/20
to Beagle Board
Where are you getting the example from?

Also, can you post the code you are using?

Cheers,

Jon

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/db0e3f88-8904-461e-bc73-680c7023b72bo%40googlegroups.com.

jennifer Dsilva

unread,
Jul 1, 2020, 1:58:58 AM7/1/20
to beagl...@googlegroups.com
bone script.png

jennifer Dsilva

unread,
Jul 1, 2020, 3:09:02 AM7/1/20
to BeagleBoard
bone script.png

jonnymo

unread,
Jul 1, 2020, 3:18:17 AM7/1/20
to Beagle Board
Sorry, I can't get that site to connect to my BBAI so I can not check to see if it works on my end.
Perhaps someone else will chime in.

Cheers

On Wed, Jul 1, 2020 at 12:09 AM jennifer Dsilva <jennifer...@gmail.com> wrote:

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Dennis Lee Bieber

unread,
Jul 1, 2020, 2:31:45 PM7/1/20
to Beagleboard
On Wed, 1 Jul 2020 11:28:30 +0530, in gmane.comp.hardware.beagleboard.user
jennifer Dsilva <jenniferdsilva09-Re...@public.gmane.org>
wrote:


Please don't post screen IMAGES... Select the TEXT, copy, and then
paste it in a message.

A screen image is useless for people using text-to-speech engines or
text-only news clients (note: I read this via gmane's news server, not as
email), and also useless for responders who would comment on specific
lines.

For me to be able to read a screen image, I have /save/ the file to my
computer, then open it using some graphics editor, and finally delete the
file to avoid cluttering up my system with spurious junk.


Having said all that...

If I try to navigate to that apparent path (starting from the "getting
started" page, I end up on beaglebone.org web server, with some option
apparently to provide the route to my beagle.

https://beagleboard.org/Support/BoneScript/demo_blinkled/

Problem #1: My BBB is connected to my NAT router/firewall. Providing my
BBB internal LAN private IP is not going to result in a connection:
192.168.1.69

"""
Exception: Please perform setTargetAddress on a valid target
"""

Try connecting to Cloud9 http://beaglebone.local:3000/ide.html (if that
doesn't work -- ie; you only have a USB connection -- replace
beaglebone.local with the IP number of the USB connection 192.168.7.2
[Windows: use .6. rather than .7. for Mac]).

Navigate down to cloud9/BeagleBone/pru; (double-) click blinkLED.js to
open the editor window.
"""
#!/usr/bin/env node
////////////////////////////////////////
// blinkLED.js
// Blinks the USR LEDs and P9_14.
// Wiring: P9_14 connects to the plus lead of an LED. The negative lead
of the
// LED goes to a 220 Ohm resistor. The other lead of the resistor
goes
// to ground.
// Setup:
// See:
////////////////////////////////////////
const b = require('bonescript');

const leds = ["USR0", "USR1", "USR2", "USR3", "P9_14"];

for(var i in leds) {
b.pinMode(leds[i], b.OUTPUT);
}

var state = b.HIGH;
for(var i in leds) {
b.digitalWrite(leds[i], state);
}

setInterval(toggle, 250);

function toggle() {
if(state == b.LOW)
state = b.HIGH;
else
state = b.LOW;
for(var i in leds) {
b.digitalWrite(leds[i], state);
}
}
"""
(see how friendlier cut/paste of the /text/ is)

Click >Run
(Ignore debugger warnings -- the Beagle should be flashing all four
on-board LEDs).




--
Dennis L Bieber

jonnymo

unread,
Jul 1, 2020, 3:04:35 PM7/1/20
to Beagle Board
Perhaps when posting code it would be best to use the Highlight Code Syntax in Google.  Not sure what formatting is used in the email but looks like from a README.

For me, I just went to the site that is in the images that Jennifer provided.  The code could be pulled from there.

However, I believe the issue is with the BeagleBoard site and not with the Cloud9 IDE on the board but could be related.

Jon

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Dennis Lee Bieber

unread,
Jul 1, 2020, 3:21:55 PM7/1/20
to Beagleboard
On Wed, 1 Jul 2020 12:03:59 -0700, in gmane.comp.hardware.beagleboard.user
jonnymo <jonnymovo-Re5JQE...@public.gmane.org> wrote:

>Perhaps when posting code it would be best to use the Highlight Code Syntax
>in Google. Not sure what formatting is used in the email but looks like
>from a README.

I read and post using Forte Agent, accessing the "forum" via gmane's
NNTP server as
Newsgroups: gmane.comp.hardware.beagleboard.user (though due to some
glitch, the reply via gmane fails to post on the end host, so I have to
remember to reply-to-email -- I only have that problem with this forum; the
other nine that I handle via gmane post properly)

The """ is a convention I use (from Python; my alternative marker is
-=-=-) to isolate cut&paste items from console windows. The code is
directly from the cloud9 editor of that demo file.

There is no option for colorizing text in my news clients


--
Dennis L Bieber

jonnymo

unread,
Jul 2, 2020, 2:35:35 AM7/2/20
to Beagle Board
I connected a BBBlack to my Ubuntu Box via USB and I still can not get the BeagleBoard.org page to connect to it. I even tried it to a Windows 10 system and still no go.
I've updated the Cloud9 code so I am not sure what the issue is. 

I looked at the Chromium debug output and this is what I see:

  Uncaught SyntaxError: Unexpected token '<'
bonescript.js:16 GET http://192.168.7.2/bonescript.js net::ERR_ABORTED 404 (Not Found)
 
However, my BBBlack gets connected at the following link, which looks like a mirror of the beagleboard.org.

I can run the scripts from the site but I don't feel comfortable with the funky URL but I at least know it is not the BBBlack nor my PC connection.

Perhaps there is an issue with the BeagleBoard.org Learn site?

Cheers,

Jon


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages