DEV Community

Remi Kristelijn
Remi Kristelijn

Posted on

WIP: Node development on iPhone

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

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

How (basics)

install ish from app store
uname -a
where are the logs

  • iSH FAQ
  • find packages to install
  • how to debug? nvim keeps on crashing, nothing in /var/log
  • how to scroll up with keyboard?
  • 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
  • can I use it?

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

source

Usage

not all commands work: vsplit etc, keeps on crashing

nvim
escape key: ctrl-c
basic noevim commands

Node

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

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

vi /etc/apk/repositories

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
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}`)
})
Enter fullscreen mode Exit fullscreen mode

Sources

Top comments (0)