MongoDB

时间:2018-06-22 04:19:16

标签: node.js mongodb reactjs react-native

我有一个正在与MongoDB一起构建的React Native应用程序(使用远程MongoDB Atlas db,并安装有npm mongodb驱动程序),但我不断遇到以下错误:

  

捆绑失败:错误:无法从“ ../node_modules/mongodb/lib/db.js”解析模块“ crypto”:Haste模块映射或以下目录中不存在模块“ crypto”:..

我知道npm crypto已不再使用,因为它现在是内置的Node模块,但是如果它是内置的,那么会发生什么呢?

如何解决此问题?我的依赖文件如下:

"dependencies": {
    "@remobile/react-native-mongoose": "^1.0.1",
    "@tradle/react-native-http": "^2.0.1",
    "assert": "^1.4.1",
    "asyncstorage-down": "^4.0.1",
    "babel-preset-env": "^1.7.0",
    "body-parser": "^1.18.3",
    "browserify-zlib": "^0.1.4",
    "bson": "^3.0.0",
    "console-browserify": "^1.1.0",
    "constants-browserify": "^1.0.0",
    "create-react-class": "^15.6.3",
    "dns.js": "^1.0.1",
    "domain-browser": "^1.2.0",
    "eslint": "^3.19.0",
    "events": "^3.0.0",
    "express": "^4.16.3",
    "https-browserify": "0.0.1",
    "husky": "^0.14.3",
    "kerberos": "0.0.24",
    "lint-staged": "^7.2.0",
    "moment": "^2.22.2",
    "mongodb": "^3.0.10",
    "mongojs": "^2.6.0",
    "mongoose": "^5.1.6",
    "morgan": "^1.9.0",
    "native-base": "^2.6.0",
    "path-browserify": "0.0.0",
    "process": "^0.11.10",
    "querystring-es3": "^0.2.1",
    "react": "^16.3.1",
    "react-native": "^0.55.4",
    "react-native-crypto": "^2.1.2",
    "react-native-level-fs": "^3.0.1",
    "react-native-os": "^1.2.1",
    "react-native-randombytes": "^3.2.0",
    "react-native-size-matters": "^0.1.1",
    "react-native-splash-screen": "^3.0.7",
    "react-native-tcp": "^3.3.0",
    "react-native-udp": "^2.3.1",
    "react-navigation": "^2.4.1",
    "readable-stream": "^1.0.33",
    "require_optional": "^1.0.1",
    "stream-browserify": "^1.0.0",
    "string_decoder": "^0.10.31",
    "timers-browserify": "^1.4.2",
    "tty-browserify": "0.0.0",
    "url": "^0.10.3",
    "util": "^0.11.0",
    "vm-browserify": "0.0.4"
  }

0 个答案:

没有答案