DEV Community

Remi Kristelijn
Remi Kristelijn

Posted on • Updated on

WIP: Node development on iPhone or iPad

Objective

  • work on Node/React projects on the go with an external keyboard with native iPad or iPhone. Not a web solution but from the shell.

Update

this is just a dump of my commands and findings. It is not stable yet, still finding out things... keep you posted

Update 20240726 - i Switched to iPad pro because iPhone 11 pro can’t use side-by side and when the console is not in focus, the website that I serve doesn’t respond and I have to alt-tab and alt-tab back.

Why even want this?

Just for fun, because I can. Practise with shell, if you have shell, you can do everything (except browsing the web for pages that use javascript).

Limitations

  • only vi seems to be stable, nvim
  • without side-by-side the server process halts when out of focus

How (basics)

install ish from app store

~ uname -a
Linux iPad 4.20.69-ish SUPER AWESOME May 20 2023 23:41:32 i686 Linux

Resources

To find out still

  • where are the logs
  • how to debug? nvim keeps on crashing, nothing in /var/log
  • how to scroll up with keyboard?
  • can I use it for web development?
  • how to restore fast after reset?

Q&A

  • how to reset to clean ish? Yes: remove the app, reinstall
  • is it persistant? Yes: after restart, it keeps the installed packages and your code

Alpine Package Keeper (apk)

apk add git
apk search nodejs-current

Editor: neovim

Don't use, not stable (at least not edge), will try

echo https://dl-cdn.alpinelinux.org/alpine/edge/main > /etc/apk/repositories
echo https://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories
apk update
apk upgrade
apk add neovim
Enter fullscreen mode Exit fullscreen mode

Usage

not all commands work: vsplit etc, keeps on crashing

nvim
escape key: ctrl-c
basic noevim commands

Shell

https://www.youtube.com/watch?v=CF1tMjvHDRA&ab_channel=JoseanMartinez

apk add curl
apk add zsh
apk add git
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Node

If you install npm and nodejs-current then you get v16.11.1 and npm 7.

➜  ~ apk search node npm
npm-7.17.0-r0
nodejs-less-4.1.1-r0
nodejs-14.21.3-r0
npm-doc-7.17.0-r0
nodejs-clean-css-5.1.2-r0
nodejs-current-doc-16.11.1-r0
nodejs-current-16.11.1-r0
nodejs-dev-14.21.3-r0
nodejs-current-dev-16.11.1-r0
npm-bash-completion-7.17.0-r0
nodejs-doc-14.21.3-r0
➜  ~ 
Enter fullscreen mode Exit fullscreen mode

To install node:

apk add nodejs-current npm
Enter fullscreen mode Exit fullscreen mode

latest is v14, v16 is there as 'current'
See https://dl-cdn.alpinelinux.org/alpine/ for latest or specific version

vi /etc/apk/repositories

Tried, but doesn’t work:a``
add:
https://dl-cdn.alpinelinux.org/alpine/latests-stable/main
https://dl-cdn.alpinelinux.org/alpine/latest-stable/community

apk upgrade

// need specific version because npm has newer versions

apk add node npm

SSH

// todo

Update the shell

// todo

Sample web project

  • mkdir -p ~/git/hub/express-test && cd "$_"
  • git init -q - generate a .git folder
  • npm init -y - init a default package.json file
  • npm i - init the node_modules folder
  • npm i express -
  • mkdir -p src && touch $_/index.js

`js
const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
res.send('Hello World!')
})

app.listen(port, () => {
console.log(Example app listening on port ${port})
})
`

Sources

Top comments (0)