Node.js on Khadas VIM

It seems that we need to port Node.js to Khadas VIM first :slight_smile:

Will research first, and update here.

I installed the latest version of Node on the Ubuntu Mate image. It was running great! I did a quick stress test on an Express web server and the results were pleasing :slight_smile:

1 Like

Can you share the steps and guidance for your effort? A professional instructions is appreciated, and we will release it on Khadas Docs with the author name as you :wink:

Sure, I will recreate the steps starting from the latest Ubuntu image.

I think we only need to run the following 2 commands.

Install Node.js:

sudo apt-get install nodejs-legacy

Install NPM:

sudo apt-get install npm

Then we should be able to see each of the versions by doing node -v and npm -v

2 Likes

I am fond of nodejs, and i also wanted to install the latest version on the VIM (pro).
My installed firmware is Ubuntu 16.04 server, dated 11feb17.
I followed the instructions published here:

But I got stuck at some point.
Here are the commands I typed:

sudo apt-get install git
sudo apt-get install wget
sudo apt-get install build-essential libssl-dev
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash -
nvm ls-remote

at this point, we are able to list all available nodejs version up to 7.7.3 as of today.
BUT this next command failed miserably:

nvm install 7.7.3

BECAUSE the function nvm_get_arch() in the file ~/.nvm/nvm.sh is returning “aarch64” instead of “arm64” which is expected (see file list in Index of /dist/v7.7.3/)

So I just modified nvm_get_arch() to return “arm64” exited my session, logged back in, then I was able to successfully run “nvm install 7.7.3”

last step to perform is:

nvm use 7.7.3

then “node --version” and “npm -v” were succesfull and we (hopefully) now can enjoy all the beauty of the latest nodejs functions on our beloved Khadas VIM;

Please try on your own and get back here to report about your success of failure.
Regards.

1 Like

Nice work ravelo. I was able to clone the latest version of nvm and it appears they have merged in a fix for the issue you were having.

I cloned the repo and then ran the install script.

git clone https://github.com/creationix/nvm.git

cd nvm && bash install.sh

Confirmed successful install of Node v7.7.3 and NPM v4.2.1

Nice work guys! :heart_eyes:

2 Likes

NVM is totally awesome.

If you are feeling up for a treat, check out GVM.

Strong typing FTW ;).

1 Like

thanks!
i could have checked for and used the latest version of nvm on its github repo but i did not think of it,
now the fixed version does take into account aarch64, great!

and now, what about doing gpio from node anyone ?
is there a valid solution someone has found and used successfully?

1 Like

@Terry has developed a demo APK on rooted Android Nougat ROM, he will release the demo source code after we release the new Android Nougat in this week.

apk are android java apps, my need is in fact some javascript linux apps which is able to do gpio, so, does @Terry have such a code ?

Do you need the source code of GPIO on android ?
We will add the support for wiringpi in the future .

1 Like

@Terry, I like Android, but here I really need to be able to write an nodejs ubuntu app.
So source code for and android apk (java or c++) might not tell me anything at all on how to do the same under nodejs and ubuntu.

The very 1st step for me is be able to read / write on a GPIO pin from (ubuntu) shell script, please take that need into account.
tks

You can follow below step to read / write the GPIO

Steps

1). You need to reconfigure the kvim_defconfig in kernel

++   CONFIG_GPIO_DEVRES=y
++   CONFIG_GPIOLIB=y
++   CONFIG_OF_GPIO=y

2). The VIM GPIO port number list

	 GPIOH5:     176
	 GPIOH6:     177
	 GPIOH7:     178
	 GPIOH8:     179
	 GPIOH9:     180
    GPIOAO6:     151

3). Write / Read the GPIO

eg: config the GPIOH5 as high level output
echo  176 > /sys/class/gpio/export
echo  out  > /sys/class/gpio/gpio176/direction
echo  1    > /sys/class/gpio/gpio176/value

eg: config the GPIOH5 as input
echo  176 > /sys/class/gpio/export
echo  in  > /sys/class/gpio/gpio176/direction

2 Likes

oh yeah !!! this is first class info and this really begins to be usefull !
I’ll test very soon and will report here

when you modify kvim_devconfig , you need to recompile and install the new kernel, right ?
if you have already done so, could you please publish the modified kernel and tell us how to deploy it on a “khadas” ubuntu server installed on emmc?
thks !

1 Like

Support for wiringpi would be game changer for gpio. I look forward to this :+1:

We released the new server Ubuntu rom.it support the GPIO contorl

3 Likes

Hi Terry,
I am a newcomer here. Please how can I get the “new server Ubuntu rom” that supports the GPIO control?

Thank you in advance.

Cheers,
Chris

The server Ubuntu ROM support the GPIO control.