Posts

Showing posts from April, 2019

Resolve error :"Unable to resolve module `crypto` in \\azure-mobile-apps-client\\node_modules\\node-uuid\\uuid.js''

I met issue "Unable to resolve module `crypto` in \\azure-mobile-apps-client\\node_modules\\node-uuid\\uuid.js'" when I developed an App using React Native and Azure Mobile App Service. The Azure Mobile App Service uses the crypto module in "uuid.js" such as "require('crypto').randomBytes", because crypto is a core Node JS module, and the React Native packager can’t package it along with app’s Javascript bundle, so it throws a runtime error: Unable to resolve module 'crypto'. I did a research on google.com, and fount out this article " Using Core Node JS Modules in React Native Apps ". Based on this article, I came out a solution to resolve this problem as below. npm install -g browserify  Create a file  crypto-in.js  that imports the  crypto  module and simply exports it:  var crypto=require("crypto"); module.exports=crypto;  Create a standalone Javascript bundle   crypto.js  using  browserify in NPM