首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >React Native的NATS.io?

React Native的NATS.io?
EN

Stack Overflow用户
提问于 2021-09-08 17:05:23
回答 1查看 245关注 0票数 0

我一直试图使用Typescript将nats.io添加到React Native项目中,但出现了很多障碍,我想知道是否有正确的方法在不修改nats的node_modules的情况下这样做(例如,将"fs“导入更改为"react-native-fs”)。这有可能做到吗?谢谢

当我做yarn添加nats或nats@latest时,首先出现的问题之一是:

代码语言:javascript
复制
**util could not be found within the project.
If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
  27 |  */
  28 | if (typeof TextEncoder === "undefined") {
> 29 |     const { TextEncoder, TextDecoder } = require("util");
     |                                                   ^
  30 |     global.TextEncoder = TextEncoder;
  31 |     global.TextDecoder = TextDecoder;
  32 | }**
EN

回答 1

Stack Overflow用户

发布于 2021-09-15 16:06:57

尝试升级您的节点版本,11+应该有该版本。如果没有,可能是您的捆绑包上的配置阻止了您使用它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69107135

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档