| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 年前 | ||
| 1 年前 | ||
| 16 天前 | ||
| 10 小时前 | ||
| 9 个月前 | ||
| 26 天前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 26 天前 | ||
| 1 个月前 | ||
| 1 年前 | ||
| 1 年前 |
1.如遇react-native-crypto相关报错,需根据其指导文档运行相关脚本命令。 文档地址:https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-crypto.md
- 如果当前环境显示异常不能运行脚本,请使用管理员权限打开PowerShell运行如下命令更改策略:
Set-ExecutionPolicy RemoteSigned
- 再执行下列脚本,按顺序执行
npm i --save-dev rn-nodeify
./node_modules/.bin/rn-nodeify --hack --install
- 如果依然出现报错异常,则把上述脚本按顺序再次执行一次即可。
- 如果当前项目运行成功,则可执行下列命令,恢复原先策略
Set-ExecutionPolicy Restricted
2.如遇Parse-SDK-JS相关报错,需根据其指导文档配置配套的服务。 文档地址:https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/Parse-SDK-JS.md
3.如遇jpush-react-native相关报错,需根据其指导文档完成极光推送相关的配置。 文档地址:https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/jpush-react-native.md
4.如运行react-native-reconnecting-websocket库,需要搭建服务器环境。搭建步骤如下(步骤基于Ubuntu 22.04.5 L 环境):
- 安装Node.js 和 npm
sudo apt install -y nodejs
- 安装 WebSocket 库
npm install ws
- 创建服务器文件
touch server.js
- 编辑 server.js 文件
const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: 8080 });
let connectionCount = 0;
let reconnectCount = 0;
wss.on('connection', function connection(ws, request) {
const clientId = ++connectionCount;
reconnectCount = 0;
ws.send('欢迎连接');
ws.on('message', function incoming(message) {
try {
const messageStr = message.toString();
if (messageStr === 'close') {
ws.send('isTrust:false');
} else if (messageStr === '橙子' || messageStr === '柠檬' || messageStr === '芒果') {
ws.send(messageStr);
} else if (messageStr === 'ping') {
ws.send('ping');
} else if (messageStr === 'reconnect') {
const welcomeMessage = '欢迎连接';
ws.send(welcomeMessage);
} else {
ws.send(`收到消息: ${messageStr}`);
}
} catch (error) {
ws.send('错误: ' + error.message);
}
});
ws.on('close', function close() {
console.log(`客户端 ${clientId} 断开连接`);
});
ws.on('error', function error(err) {
console.error(`客户端 ${clientId} 错误:`, err);
});
});
wss.on('error', function error(err) {
console.error('服务器错误:', err);
});
process.on('SIGINT', () => {
console.log('关闭 WebSocket 服务器...');
wss.close(() => {
process.exit(0);
});
});
5.npm run dev如果遇到找不到源库的报错,可以尝试使用npm i -f来安装依赖库。