【问题标题】:Module not found: Can't resolve 'react-native' in '/app/node_modules/react-native-aes-crypto'找不到模块:无法解析“/app/node_modules/react-native-aes-crypto”中的“react-native”
【发布时间】:2018-06-26 10:56:04
【问题描述】:

我想使用react-native-aes-crypto,但它需要react-native。我安装了它,但它仍然说找不到它。

我尝试重新安装它,添加他的依赖项但没有任何效果。

我的 package.json:

{
  "name": "neko_web",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@fortawesome/fontawesome": "^1.1.8",
    "@fortawesome/react-fontawesome": "0.0.20",
    "@trendmicro/react-sidenav": "^0.4.5",
    "ajv": "^6.5.1",
    "create-react-app": "^1.5.2",
    "font-awesome": "^4.7.0",
    "moment": "^2.22.2",
    "react": "16.3.1",
    "react-cookie": "^2.2.0",
    "react-dom": "^16.4.0",
    "react-icons-kit": "^1.1.5",
    "react-moment": "^0.7.7",
    "react-native": "^0.55.4",
    "react-native-aes-crypto": "^1.2.1",
    "react-router-dom": "^4.3.1",
    "react-scripts": "1.1.4",
    "react-sidenav": "^2.1.3"
  },
  "scripts": {
    "start": "PORT=3005 react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

当我做import Aes from 'react-native-aes-crypto'时出现错误

更新 1:
我已尝试将 react-native 的版本更改为 0.55.0,无需再进行审核修复,但它显示相同的错误。

【问题讨论】:

  • 你安装了 react-native-cli 吗?
  • 不,我已经为 AES 准备了另一个包,但我认为是这样

标签: reactjs react-native aescryptoserviceprovider


【解决方案1】:

安装包react-native-cli 来解决这个问题。

如果您想要另一个不需要 react-native 的包,请使用 simple-encryptor

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-29
    • 2023-02-16
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 2022-06-29
    • 2016-10-27
    • 1970-01-01
    相关资源
    最近更新 更多