ish-app / ish

Linux shell for iOS
https://ish.app
Other
16.58k stars 871 forks source link

Has anyone gotten nodejs and npm running? #2120

Open mjgs opened 1 year ago

mjgs commented 1 year ago

I’m trying to run a simple http server and browse files/pages from Safari.

Installing nodejs works:

Mark-Smiths-iPod:~# apk add nodejs
fetch http://apk.ish.app/v3.14-2023-05-19/main/x86/APKINDEX.tar.gz
fetch http://apk.ish.app/v3.14-2023-05-19/community/x86/APKINDEX.tar.gz
(1/7) Installing ca-certificates (20230506-r0)
(2/7) Installing nghttp2-libs (1.43.0-r0)
(3/7) Installing brotli-libs (1.0.9-r5)
(4/7) Installing c-ares (1.17.2-r0)
(5/7) Installing libgcc (10.3.1_git20210424-r2)
(6/7) Installing libstdc++ (10.3.1_git20210424-r2)
(7/7) Installing nodejs (14.21.3-r0)
Executing busybox-1.33.1-r6.trigger
Executing ca-certificates-20230506-r0.trigger
OK: 47 MiB in 21 packages
Mark-Smiths-iPod:~# node -v
v14.21.3

Installing npm appears to work:

apk add npm
(1/1) Installing npm (7.17.0-r0)
Executing busybox-1.33.1-r6.trigger
OK: 61 MiB in 22 packages
Mark-Smiths-iPod:~# which npm
/usr/bin/npm
Mark-Smiths-iPod:~# npm --version
7.17.0

But npm always just hangs:

Mark-Smiths-iPod:~# npm install -g http-server
^C

Has anyone gotten nodejs and npm running? Is it even possible?

Shogoki commented 1 year ago

For me nodejs and npm is working fine with the sam versions as you are having on iPhone 11 and iSh 1.3.2

However, the http-server module is not working for me. But the http.server from python works really well, as described here: https://github.com/ish-app/ish/wiki/Running-a-Python-Web-Server

Dlurak commented 1 year ago

On my iPhone 11 it works perfectly. But on my iPad 9th gen. I always get a segmentation fault when I try to install something.

mjgs commented 1 year ago

Thanks for the reply @Dlurak

I tried running the npm command again today. This time it ran after about 30 seconds. However after looking good for a few minutes, appearing to install various packages it terminated with:

Mark-Smiths-iPod:~# npm install -g http-
server
npm install -g http-server[.............[                  ] - reify:async: http fetch GET 200 https://registry.n

#
# Fatal error in , line 0
# Check failed: fixed_size_above_fp + (stack_slots * kSystemPointerSize) - CommonFrameConstants::kFixedFrameSizeAboveFp + outgoing_size == result.
#
#
#
#FailureMessage Object: 0xffff84c4
Illegal instruction

Is that the same as what you were seeing in your iPad? What OS version is your iPhone running?

I really want to get a nodejs web server running.

Anyone have some ideas how to get past this blockage?