{"id":1813,"date":"2022-05-09T15:27:35","date_gmt":"2022-05-09T07:27:35","guid":{"rendered":"https:\/\/rogen.us\/how-to-install-nodejs-on-android\/"},"modified":"2022-05-09T15:27:35","modified_gmt":"2022-05-09T07:27:35","slug":"how-to-install-nodejs-on-android","status":"publish","type":"post","link":"https:\/\/rogen.us\/en\/how-to-install-nodejs-on-android\/","title":{"rendered":"How to install nodejs on android step by step"},"content":{"rendered":"<p><![CDATA[\n\n<h2 id=\"basicinformation\">Basic Information<\/h2>\n\n\n\n\n\n<p><strong>Equipment<\/strong>:Samsung Galaxy M30s<\/p>\n\n\n\n\n\n<p><strong>Android version<\/strong>:11<\/p>\n\n\n\n\n\n<p><strong>Kernel version<\/strong>:4.14.113-22430363<\/p>\n\n\n\n\n\n<p><strong>App name<\/strong>:Termux<\/p>\n\n\n\n\n\n<p><strong>App version<\/strong>:0.117<\/p>\n\n\n\n\n\n<h2 id=\"hereisthetutorial\">Here is the tutorial<\/h2>\n\n\n\n\n\n<p><em>1<\/em>. Install Termux from Play Store or other app markers or <a href=\"https:\/\/github.com\/termux\/termux-app\/releases\">github<\/a> where you can find the latest version .<\/p>\n\n\n\n\n\n<p><em>2<\/em>. Open the Termux<\/p>\n\n\n\n\n\n<p><em>3<\/em>. Working with Codes<\/p>\n\n\n\n\n\n<p>&ensp;&ensp;&ensp;<code>pkg upgrade<\/code> \/\/This is not necessary.<\/p>\n\n\n\n\n\n<p>&ensp;&ensp;&ensp;<code>pkg install nodejs<\/code> \/\/This will install node and npm programs in your termux.<\/p>\n\n\n\n\n\n<p><strong>PS<\/strong>\uff1aWith <code>pkg install &lt;package&gt;<\/code>you can try other packages you want to install.<\/p>\n\n\n\n\n\n<h2 id=\"howtorunanodejsscript\">How to run a nodejs script<\/h2>\n\n\n\n\n\n<p>Run commands: <br \/>\n<em>1<\/em>. <code>termux-setup-storage<\/code> \/\/Get phone storage access.This will generate a <strong>storage<\/strong> folder under the termux directory.<\/p>\n\n\n\n\n\n<p><em>2<\/em>. <code>cd storage<\/code> \/\/Go to the storage folder.<\/p>\n\n\n\n\n\n<p><em>3<\/em>. <code>ls<\/code> \/\/List of subdirectories under the folder,for me, <strong>downloads<\/strong> which corresponds to <strong>Download<\/strong> in my phone. So, before you can run a nodejs script in termux, copy it to the <strong>Download<\/strong> folder.<\/p>\n\n\n\n\n\n<p><em>4<\/em>. <code>cd downloads<\/code>then<code>cd node<\/code> \/\/ node is my nodejs script folder name.<\/p>\n\n\n\n\n\n<p><em>5<\/em>. Run node command such as <code>node local.js<\/code> to run your script.<\/p>\n\n\n\n\n\n<p><strong>PS<\/strong>:My phone is not rooted, so I usually run the <code>npm install<\/code> command in my nodejs script folder on the PC, then copy the folder to the <strong>Download<\/strong> folder in my phone, and then use the node command in termux to run the nodejs script.It is worth mentioning that the version of node on the PC should be the same as the version in termux or lower than it. You can run <code>node -v<\/code>to see the version.<\/p>\n\n]]><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Basic Information&#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[250],"tags":[],"class_list":["post-1813","post","type-post","status-publish","format-standard","hentry","category-coding-notes","wpcat-250-id"],"views":67,"_links":{"self":[{"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/posts\/1813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/comments?post=1813"}],"version-history":[{"count":0,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/posts\/1813\/revisions"}],"wp:attachment":[{"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/media?parent=1813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/categories?post=1813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/tags?post=1813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}