The package at node_modules\crypto-js\core.js attempted to import the Node standard library module crypto. It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/workflow/using-libraries/#using-third-party-libraries
Getting this error when running npm start
for expo instead of crypto you can use expo-crypto
you can install it as below
expo install expo-crypto
in your codes
import React, { useEffect } from 'react';
import { StyleSheet, View, Text } from 'react-native';
import * as Crypto from 'expo-crypto';
export default function App() {
useEffect(() => {
(async () => {
const digest = await Crypto.digestStringAsync(
Crypto.CryptoDigestAlgorithm.SHA256,
'Github stars are neat'
);
console.log('Digest: ', digest);
/* Some crypto operation... */
})();
}, []);
...
as from expo documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With