在Android中运行NodeJs服务器 [英] Run NodeJs server in Android

查看:1415
本文介绍了在Android中运行NodeJs服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在android设备(例如linux设备而不是android应用)中运行NodeJs服务器.

Is it possible to run NodeJs server in android device (like linux devices not android apps).

如果可能,请帮助我.

是否可以在Android设备上启动mongo服务器?

And is it possible to start mongo server on Android device?

我的设备:

  • RK3288电视盒(android 4)
  • 华硕fonepad 7(Android 5操作系统)
  • LG Optimus G(Android 4根)

重要!!我想在android中启动服务器应用程序.因为我有一个未使用的android TV-Box,我想在我的家庭服务器中使用它

Important!! I want to start a server app in android. because I have an unused android TV-Box and I want to use it in my home server

而且我不想在APK文件中使用它(以将HTML文件加载到WebView中).我需要nodejs服务器而不是具有CommonJs和RequireJs的javascript客户端

And I don't want to use it in APK files (to load html files in WebView s). I need nodejs server not javascript client with CommonJs and RequireJs

推荐答案

您可能希望在android设备上安装chrooted-linux,如

You might want to install a chrooted-linux on your android-device, as explained here.

简而言之,请执行以下操作:

In short, do this:

  1. 准备linux-image
  1. prepare linux-image
  1. 在任何gnu + linux -device上执行此操作.
  2. 创建一个大文件(> 1 GB)
  3. 将其格式化为文件系统(例如ext2)
  4. 安装.
  5. 复制其中的发行版(例如,使用debootstrap)

  • 将loopdevice复制到android
  • 安装(需要root)

  • copy loopdevice to android
  • mount it (root required)

    1. 也许安装busybox
    2. 将某些目录从根设备附加到主机(通常是devdev/ptsprocsys)
    1. maybe install busybox
    2. attach some directories from the root-device to the host (usually dev, dev/pts, proc and sys )

  • chroot
  • 在chroot中安装nodejs
  • 注意:我做过类似于tf301的事情,它的工作原理很吸引人.但是当我开始在chroot中使用过多的内存时(例如在编译android-app时),主机将崩溃.我还没有遇到过节点崩溃的情况,我也不知道其他设备是否受此影响.

    note: I have done something similar to my tf301 and it works like a charm. But when I start to use too much memory inside the chroot (e.g. when compiling an android-app), the host will crash. I have not yet experienced those crashes with node and I do not know, if other devices are affected by this.

    这篇关于在Android中运行NodeJs服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆