在 Android 上运行 Node.Js [英] Running Node.Js on Android
问题描述
所以我知道这已经受到了很多质疑.准确地说,例如在这些问题中:
So I know this has been questioned quite a lot. To be exact for example in these questions:
虽然每个选项都有问题:
Every option presented has a problem though:
我想在我的普通设备上运行它,所以我不想在我的设备上安装另一个操作系统
I want to run it on my normal device so I would like to avoid installing another OS on my Device
上个月停止了 JXCore 的工作,(可能因此)我无法编译它(参见 无法安装 jxcore-cordova)
Work on JXCore was stopped last month and (maybe as a result) I couldn't get it to compile (see Can't install jxcore-cordova)
自从这些问题发布以来,作为最佳选择"的 JXCore 现在似乎无法使用了:
有没有办法在 Android 设备上运行 node.js 应用程序(在我的例子中是服务器)?
With the time that past since these questions have been posted and as the "best option" JXCore seem to be now unusable:
Is there a way to run a node.js application (a server in my case) on an Android device?
如果您想知道为什么我想要这个:我使用 Node.Js 服务器制作了一个 WebApp,现在我想要一个版本,您可以在不需要互联网连接的情况下从手机本地启动.这意味着服务器需要在 Android 手机上运行.
if you're wondering why I'd want this: I made a WebApp with a Node.Js server and I now want a version you can launch locally from your phone without requiring an Internet connection. This means the server needs to run on an Android phone.
推荐答案
我刚刚经历了一个令人瞠目结舌的时刻 - Termux 允许你在 Android 设备上安装 NodeJS!
I just had a jaw-drop moment - Termux allows you to install NodeJS on an Android device!
它似乎适用于我手头的基本 Websocket 速度测试.它提供的http既可以在本地访问,也可以在网络上访问.
It seems to work for a basic Websocket Speed Test I had on hand. The http served by it can be accessed both locally and on the network.
有一个 介绍安装过程的中篇文章
基本上:1.安装termux2. apt 安装 nodejs3. 节点起来!
Basically: 1. Install termux 2. apt install nodejs 3. node it up!
我遇到的一个限制 - 共享文件夹似乎没有安装模块所需的权限.它可能只是一个文件权限问题.私有应用存储空间运行良好.
One restriction I've run into - it seems the shared folders don't have the necessary permissions to install modules. It might just be a file permission thing. The private app storage works just fine.
这篇关于在 Android 上运行 Node.Js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!