Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用';净';ReactNative中的Node.js模块_Node.js_Reactjs_React Native - Fatal编程技术网

使用';净';ReactNative中的Node.js模块

使用';净';ReactNative中的Node.js模块,node.js,reactjs,react-native,Node.js,Reactjs,React Native,我想在react原生移动应用程序中使用Node.js模块 我首先创建了一个简单的node.js脚本,用以下代码测试客户机/服务器连接 const net = require('net'); const client = new net.Socket(); client.connect({ port: 59090, host: process.argv[2] }); client.on('data', (data) => { console.log(data.toString('utf

我想在react原生移动应用程序中使用Node.js模块

我首先创建了一个简单的node.js脚本,用以下代码测试客户机/服务器连接

const net = require('net');

const client = new net.Socket();
client.connect({ port: 59090, host: process.argv[2] });
client.on('data', (data) => {
  console.log(data.toString('utf-8'));
});
一切正常,但当我从ReactNative应用程序调用此脚本时,出现以下错误:

Unable to resolve module `net` from `Client.js`: net could not be found within the project.
为什么我不能在react本机应用程序中使用node.js库?还有别的选择吗