Uncaught TypeError: Cannot read properties of undefined (reading 'getConstants') after just using import...
I have just installed it with: npm i react-native-esc-pos-printer
I am trying this on new react-native project. So I just initialized it with expo init and added import in app.js.
import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";
import EscPosPrinter, {
getPrinterSeriesByName,
} from "react-native-esc-pos-printer";
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to ss tart working on your app!</Text>
<StatusBar style="auto" />
</View>
);
}
And then I get this error, am I missing something?
Uncaught TypeError: Cannot read properties of undefined (reading 'getConstants') at ./node_modules/react-native-esc-pos-printer/lib/module/constants.js (constants.ts:16:1) at webpack_require (bootstrap:24:1) at fn (hot module replacement:62:1) at ./node_modules/react-native-esc-pos-printer/lib/module/utils/getPrinterSeriesByName.js (getPrinterLanguage.ts:17:1) at webpack_require (bootstrap:24:1) at fn (hot module replacement:62:1) at ./node_modules/react-native-esc-pos-printer/lib/module/utils/index.js (getPrinterSeriesByName.ts:12:1) at webpack_require (bootstrap:24:1) at fn (hot module replacement:62:1) at ./node_modules/react-native-esc-pos-printer/lib/module/index.js (constants.ts:353:1)
Are you running it on Expo Go, or development client?
@tolypash Does that make a diffference?
@AnointingMax Yes, Expo Go only has a set of native dependencies installed, so if you want this package you need to run your app on expo development client where all the native dependencies required by your app are bundled together