有许多旧的SO线程处理在Android上运行NodeJS.其中大多数不再可行(JXCore)和/或提供令人困惑,过时,不完整或错误的信息.
因此,我调查了目前(截至2017年8月)可行的方法,并找到了三个可能的候选人.
要在他们之间做出决定,我想知道:
可行的方法是:
除此之外,我还找到了许多相关的有趣资源:
我只是尝试将一些节点模块添加到react-native中。我发现它只能与反应本机模块和react-native link
该模块一起使用。
我想使用: - https://www.npmjs.com/package/node-google-image-search 或 - https://www.npmjs.com/package/first-image-search-load
当我使用带有“非反应模块”的命令链接时,我仍然什么也得不到:
另外,当我试图通过以下方式添加此模块时:
import 'first-image-search-load'
import {saveFirstImage} from 'first-image-search-load'
import * from 'first-image-search-load'
var first-image-search-load = require('first-image-search-load');
var first-image-search-load = require('./first-image-search-load');
var first-image-search-load = require('./node-modules/first-image-search-load');
并尝试将它们放入 index.android.js 我得到:
开发服务器返回响应错误码:500
网址: http ://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false
正文:{“message”:“无法解析来自 /Users/Pien/Projects/smog_bielsko/node_modules/node-google-image-search/index.js 的模块 https:模块映射或这些目录中不存在模块: \n /Users/Pien/Projects/smog_bielsko/node_modules/node-google-image-search/node_modules\n、/Users/Pien/Projects/smog_bielsko/node_modules\n\n这可能与https://github.com相关/facebook/react-native/issues/4968 \n要解决此问题,请尝试以下操作:\n 1. 清除守望者手表:
watchman watch-del-all
.\n 2. 删除node_modules
文件夹:rm -rf node_modules && npm install
.\n 3. 重置打包器缓存:rm -fr $TMPDIR/react-*
或 …