DEV Community

Cover image for How To Create a React Application on an Android Device: A Step-by-Step Guide

How To Create a React Application on an Android Device: A Step-by-Step Guide

Andrew Ezeani on September 24, 2023

Table of Content Introduction Prerequisites Setting up your Android Phone Developing the Todo App with Acode Importing the project i...
Collapse
 
anita_patil_521e1f5ce79af profile image
Anita Patil

Getting and Error while running npm run dev Pls Help :

chatbot@0.0.0 dev
vite

/data/data/com.termux/files/home/react-course/chatbot/node_modules/rollup/dist/native.js:64
throw new Error(
^

Error: Cannot find module @rollup/rollup-android-arm64. npm has a bug related to optional dependencies (github.com/npm/cli/issues/4828). Please try npm i again after removing both package-lock.json and node_modules directory.
at requireWithFriendlyError (/data/data/com.termux/files/home/react-course/chatbot/node_modules/rollup/dist/native.js:64:9)
at Object. (/data/data/com.termux/files/home/react-course/chatbot/node_modules/rollup/dist/native.js:73:76)
at Module.compile (node:internal/modules/cjs/loader:1738:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1871:10)
at Module.load (node:internal/modules/cjs/loader:1470:32)
... 2 lines matching cause stack trace ...
at wrapModuleLoad (node:internal/modules/cjs/loader:238:24)
at cjsLoader (node:internal/modules/esm/translators:317:5)
at ModuleWrap. (node:internal/modules/esm/translators:209:7) {
[cause]: Error: dlopen failed: cannot locate symbol "
_emutls_get_address" referenced by "/data/data/com.termux/files/home/react-course/chatbot/node_modules/@rollup/rollup-android-arm64/rollup.android-arm64.node"...
at Module._extensions..node (node:internal/modules/cjs/loader:1898:18)
at Module.load (node:internal/modules/cjs/loader:1470:32)
at Module._load (node:internal/modules/cjs/loader:1290:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:238:24)
at Module.require (node:internal/modules/cjs/loader:1493:12)
at require (node:internal/modules/helpers:152:16)
at requireWithFriendlyError (/data/data/com.termux/files/home/react-course/chatbot/node_modules/rollup/dist/native.js:46:10)
at Object. (/data/data/com.termux/files/home/react-course/chatbot/node_modules/rollup/dist/native.js:73:76)
at Module._compile (node:internal/modules/cjs/loader:1738:14) {
code: 'ERR_DLOPEN_FAILED'
}
}

Node.js v24.6.0

Collapse
 
mgtv_s profile image
Dmitrii

Thanks for article, very great! I recently read article about how much it would cost to develop on react native, i think it may be useful :)

Collapse
 
lui2mi profile image
Luis Miguel Meza Mendoza

Great guide! and I have a question. Idk if is only happening to me.
after "pkg install nodejs" gives me an error "CANNOT LINK EXECUTABLE "node": library "libicui18n.so.73" not found" on a fresh install

Collapse
 
andrewezeani profile image
Andrew Ezeani

It seems like a dependency issue. You can try uninstalling your termux if it's installed from the Google playstore and download one from fdroid. If that doesn't solve the issue, try running pkg update && pkg upgrade to upgrade your termux to the latest version. Then try running the command again. If it doesn't work, then it probably has something to do with the version of your device.

Collapse
 
lui2mi profile image
Luis Miguel Meza Mendoza

Thanks for reply, indeed I had to update and upgrade, but also install git, openssl-tool, build-essential, python and proot, to make it work

Collapse
 
kato147 profile image
Tỏn nè

i have error :  ERR_PNPM_EPERM  EPERM: operation not permitted, symlink '../../../@babel+plugin-syntax-private-property-in-object@7.14.5_@babel+core@7.26.10/node_modules/@babel/plugin-syntax-private-property-in-object' -> '/storage/emulated/0/code/myPortfolio/node_modules/.pnpm/@babel+plugin-proposal-private-property-in-object@7.21.11_@babel+core@7.26.10/node_modules/@babel/plugin-syntax-private-property-in-object'
when i pnpm install. how can i fix it ? please
realme i5 android 10

Collapse
 
andrewezeani profile image
Andrew Ezeani

Sorry for the late reply. You're seeing this error because you're likely running the command in a folder within your device's shared storage, where Termux can't create symbolic links. pnpm relies on symlinks to manage dependencies. To fix it, move the myPortfolio folder to Termux's home directory and rerun the install command.

Collapse
 
royal_gamer_6014f452b95b0 profile image
Royal gamer

Thank you so much But I use Speck node editor which is very good, you can try it

Collapse
 
lqdm12 profile image
Leonard Mendonça

Thank you so much for the guide! I'm happy because I can use reactjs on my cellphone now :D

Collapse
 
andrewezeani profile image
Andrew Ezeani

You're welcome. I'm glad you found it helpful

Collapse
 
apolizy profile image
Emmanuel precious omonigho

Please how do I use it for a website I'm creating ?

Collapse
 
andrewezeani profile image
Andrew Ezeani

If it's a React application, it'll be by Following the steps outlined in the article