简体   繁体   中英

nvm install nodejs onto raspberry pi via ssh erroring

I am trying to download ARM version of node 14 for a Raspberry Pi via NVM and SSH (from my mac).

My Raspberry Pi is Raspberry Pi 2 Model B+ V1.2 2014

I have a 64GB SD card.

Architecture returns:

lharby@raspberrypi:/usr/bin $ uname -m
armv6l

I managed to download and install nvm:

lharby@raspberrypi:~/Downloads $ nvm --version
0.33.11

Then I tried nvm install 14 . I am assuming I don't need to pass any arguments or flags to this and it will know the target architecture.

I have tried doing this directly on the Pi and via SSH. It takes hours, and I finally get this error at the end of the console:

v14.21.2/files/out/Release/obj.target/icudata/gen/icudt70_dat.o /home/lharby/.nvm/.cache/src/node-v14.21.2/files/out/Release/obj/gen/icudt70_dat.S '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DU_ATTRIBUTE_DEPRECATED=' '-D_CRT_SECURE_NO_DEPRECATE=' '-DU_STATIC_IMPLEMENTATION=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' -I../deps/icu-small/source/common  -pthread -Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Wno-strict-aliasing -O3 -fno-omit-frame-pointer  -MMD -MF /home/lharby/.nvm/.cache/src/node-v14.21.2/files/out/Release/.deps//home/lharby/.nvm/.cache/src/node-v14.21.2/files/out/Release/obj.target/icudata/gen/icudt70_dat.o.d.raw   -c
cc: fatal error: Killed signal terminated program cc1
compilation terminated.
make[1]: *** [tools/icu/icudata.target.mk:153: /home/lharby/.nvm/.cache/src/node-v14.21.2/files/out/Release/obj.target/icudata/gen/icudt70_dat.o] Error 1
make: *** [Makefile:109: node] Error 2
nvm: install v14.21.2 failed!

If I run nvm ls I get this:

lharby@raspberrypi:/usr/bin $
nvm ls
               
->       system
node -> stable (-> N/A) (default)
iojs -> N/A (default)
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.2 (-> N/A)
lts/gallium -> v16.19.0 (-> N/A)
lts/hydrogen -> v18.12.1 (-> N/A)

I have also tried this argument:

sudo apt-get install -y node npm

Aswell as manually downloading the specific version for the Pi

lharby@raspberrypi:~/Downloads $ ls node-v14.18.0-linux-arm64 node-v14.18.0-linux-arm64.tar.gz node-v14.18.0-linux-arm64.tar.xz

And then copying the files via this command sudo cp -R * /usr/local/ as per this article: https://www.makersupplies.sg/blogs/tutorials/how-to-install-node.js-and-npm-on-the-raspberry-pi

I have rebooted and gone through the nvm install 14 again.

Also when I run node -v I get this

lharby@raspberrypi:/usr/bin $ node -v -bash: /usr/local/bin/node: cannot execute binary file: Exec format error

And if I check the binary for node I get this:

lharby@raspberrypi:/usr/bin $ file node node: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=13d12facc999f5948728d89ae48b50cf3ed69662, for GNU/Linux 3.2.0, stripped

So it seems as though it is installed and the correct version/architecture.

I believe my Pi only has 1GB Ram.

So, am I going about this the right way? Is the Pi capable of running an app built in node v.14?

My plan is to host a nodejs app I have built and run the pi as a server. Really not sure what else to try, so I hope someone can help. NVM is not essential, so manually installing v14 should be OK for now, but of course NVM would give me more options to future proof it. TIA

The node versions you get with nvm are not compatible with your Arm architecture of your RasberryPi.

Download the nodejs Binaries and do an installation from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM