How to install NodeJS on Tizen device?

361 Views Asked by At

I managed to install Tizen (version 6/Unified) on RaspberryPi4 and now I am trying to install NodeJS, version 8 or greater:

$ curl -O https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-armv7l.tar.gz
$ tar -xf node-v8.9.4-linux-armv7l.tar.gz --directory /usr/local --strip-components 1 

$ cd /usr/local/bin
$ ls
node  npm  npx

Then I want to verify with:

node -v

but it returns:

bash: /usr/local/bin/node: No such file or directory

What am I missing?

Edit:

$ file /usr/local/bin/node
/usr/local/bin/node: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.26, BuildID[sha1]=a5fb63d28c3df67556a467e16c7f8a22514de1b3, with debug_info, not stripped

$ file /bin/ls
/bin/ls: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, BuildID[sha1]=40037c7fa87a4759ca2a7deee772a008b05cea97, for GNU/Linux 3.2.0, stripped

It seems I need to compile it on my own. /lib/ld-linux-armhf.so.3 is not present in my system.

1

There are 1 best solutions below

0
On BEST ANSWER
You can build nodejs rpm from source with gbs on Ubuntu 18.04 or 16.04.
1. Get the source from nodejs site.
wget https://nodejs.org/dist/latest-v8.x/node-v8.17.0.tar.gz

2. Extract tarball.
tar zxvf node-v8.17.0.tar.gz

3. Copy some files for gbs build from tizen nodejs git.
cd node-v8.17.0
mkdir packaging
cd packaging
wget https://git.tizen.org/cgit/platform/upstream/nodejs/plain/packaging/nodejs.spec
wget https://git.tizen.org/cgit/platform/upstream/nodejs/plain/packaging/nodejs.pc.in
https://git.tizen.org/cgit/platform/upstream/nodejs/plain/packaging/nodejs.manifest

4. modifiy nodejs.spec
@@ -1,5 +1,5 @@
 Name:          nodejs
-Version:       4.4.3
+Version:       8.17.0
 Release:       1
 Summary:       Evented I/O for V8 JavaScript
 Group:         System/Service

@@ -73,7 +73,7 @@ rm -fr %{buildroot}/usr/share/man
 %manifest %{name}.manifest
 %defattr(-,root,root)
 %{_bindir}/node
-%license LICENSE LICENSE.Apache-2.0
+# %license LICENSE LICENSE.Apache-2.0

 %files devel
 %{_includedir}/node/
@@ -81,5 +81,6 @@ rm -fr %{buildroot}/usr/share/man

 %files npm
 %{_bindir}/npm
+%{_bindir}/npx
 /usr/lib/node_modules/npm/

5. git init
git init
git add -A
git commit -am "init"

6. gbs build
gbs -c <your conf file> build -A armv7l --include-all

7. install nodejs rpm to target.

root:~> node -v
v8.17.0


### You can use the below gbs config. ###
[general]
#Current profile name which should match a profile section name
profile = profile.tizen_unified_55

[profile.tizen_unified_55]
#Common authentication info for whole profile
obs = obs.tizen

repos = repo.public_base_arm, repo.tizen_unified_55
buildroot = ~/GBS-ROOT/tizen_unified_55

[obs.tizen]
#OBS API URL pointing to a remote OBS.
url = https://api.tizen.org

[repo.public_base_arm]
url = http://download.tizen.org/snapshots/tizen/5.5-base/latest/repos/standard/packages/

[repo.tizen_unified_55]
url = http://download.tizen.org/snapshots/tizen/5.5-unified/latest/repos/standard/packages/