Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crypto : while trying to resolve module 'crypto' #21491

Closed
medmsd opened this issue Oct 4, 2018 · 8 comments
Closed

Crypto : while trying to resolve module 'crypto' #21491

medmsd opened this issue Oct 4, 2018 · 8 comments
Labels
Resolution: Locked This issue was locked by the bot. Type: Invalid This issue does not belong here. Applying this label will cause issue to be closed.

Comments

@medmsd
Copy link

medmsd commented Oct 4, 2018

Environment:
OS: Windows 10
Node: 8.12.0
Yarn: 1.9.4
npm: 3.10.9
Watchman: 4.9.4
Xcode: N/A
Android Studio: Version 3.1.0.0 AI-173.4720617

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4

Description
i can't solve that error , i have installed crypto , or upgrade it and reinstall it , still the same problem
image

//this is helpers.js
'use strict'

var jsonSafeStringify = require('json-stringify-safe')
var crypto = require('crypto')
var Buffer = require('safe-buffer').Buffer

var defer = typeof setImmediate === 'undefined'
  ? process.nextTick
  : setImmediate

function paramsHaveRequestBody (params) {
  return (
    params.body ||
    params.requestBodyStream ||
    (params.json && typeof params.json !== 'boolean') ||
    params.multipart
  )
}

function safeStringify (obj, replacer) {
  var ret
  try {
    ret = JSON.stringify(obj, replacer)
  } catch (e) {
    ret = jsonSafeStringify(obj, replacer)
  }
  return ret
}

function md5 (str) {
  return crypto.createHash('md5').update(str).digest('hex')
}

function isReadStream (rs) {
  return rs.readable && rs.path && rs.mode
}

function toBase64 (str) {
  return Buffer.from(str || '', 'utf8').toString('base64')
}

function copy (obj) {
  var o = {}
  Object.keys(obj).forEach(function (i) {
    o[i] = obj[i]
  })
  return o
}

function version () {
  var numbers = process.version.replace('v', '').split('.')
  return {
    major: parseInt(numbers[0], 10),
    minor: parseInt(numbers[1], 10),
    patch: parseInt(numbers[2], 10)
  }
}

exports.paramsHaveRequestBody = paramsHaveRequestBody
exports.safeStringify = safeStringify
exports.md5 = md5
exports.isReadStream = isReadStream
exports.toBase64 = toBase64
exports.copy = copy
exports.version = version
exports.defer = defer
@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.

The ":rewind:Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@kelset
Copy link
Contributor

kelset commented Oct 5, 2018

It looks like you did something wrong with your installation of crypto, I don't see how this is a react-native issue.

@kelset kelset closed this as completed Oct 5, 2018
@kelset kelset added the Type: Invalid This issue does not belong here. Applying this label will cause issue to be closed. label Oct 5, 2018
@medmsd
Copy link
Author

medmsd commented Oct 5, 2018

Even when i didnt install crypto its not from crypto installation

@medmsd
Copy link
Author

medmsd commented Oct 5, 2018

@kelset even when i didnt install crypto it gots me that error i dont know why i dont think its from crypto

@kelset
Copy link
Contributor

kelset commented Oct 5, 2018

Please create a repro that shows that the issue is caused by react-native and I'll reopen the issue.

@medmsd
Copy link
Author

medmsd commented Oct 5, 2018

Please create a repro that shows that the issue is caused by react-native and I'll reopen the issue.

https://github.com/mameya007/Chat this is mine , any help please

@kelset
Copy link
Contributor

kelset commented Oct 8, 2018

@mameya007 a few things:

  1. have you tried replicating in the latest version of RN? (the proj you linked is on 0.55)
  2. it seems that you have both crypto (which I feel you should not have in the package.json) and an outdated version of react-native-crypto, have you tried migrating to the latest version and reinstalling properly? It seems that it's kinda hacky, the installation flow, so I suggest that you open an issue there since I feel it may be related to that https://github.com/tradle/react-native-crypto

@medmsd
Copy link
Author

medmsd commented Oct 9, 2018

@mameya007 a few things:

  1. have you tried replicating in the latest version of RN? (the proj you linked is on 0.55)
  2. it seems that you have both crypto (which I feel you should not have in the package.json) and an outdated version of react-native-crypto, have you tried migrating to the latest version and reinstalling properly? It seems that it's kinda hacky, the installation flow, so I suggest that you open an issue there since I feel it may be related to that https://github.com/tradle/react-native-crypto

i upgraded it and still the same + ok i will try to open an issue there and thanks for the help

@facebook facebook locked as resolved and limited conversation to collaborators Oct 5, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot. Type: Invalid This issue does not belong here. Applying this label will cause issue to be closed.
Projects
None yet
Development

No branches or pull requests

3 participants