I'm getting this error on node when I try and npm run android my react native app
Unable to resolve "./printError" from
"node_modules/graphql/error/index.js
The error only occurs when attempting to import any libraries that require Graphql. Graphql is installed, and I've uninstalled and reinstalled my node_modules several times attempting to fix this but nothing works. Any help would be appreciated.
printError was added with v0.12.0. Apollo requires at least v14.5.4. You can install the latest version with npm install graphql#latest.
Related
I am using https://reactnative.dev/docs/environment-setup 0.64
I npm install #walletconnect/client
put below import in App.js
import WalletConnect from "#walletconnect/client";
after npx react-native run-ios and got below error:
error: Error: While trying to resolve module `crypto` from file `/Users/hahaha/workspace/mobile/reactnative/nonft/node_modules/#pedrouid/iso-crypto/dist/cjs/helpers/env/node.js`, the package `/Users/hahaha/workspace/mobile/reactnative/nonft/node_modules/crypto/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/hahaha/workspace/mobile/reactnative/nonft/node_modules/crypto/index.js`. Indeed, none of these files exist:
I tried to remove node_modules folder and npm install again but still get the same error.
I am sure that it is thrown by #walletconnect/client because when I removed
import WalletConnect from "#walletconnect/client";
then the error gone
crypto is a built in Node module, which isn't available in React Native, as iOS/Android apps don't run with a Node runtime - only web apps do.
There are a few ways to solve this problem, all of them fairly hacky.
One way is to replace the crypto module with a React Native native module that does the same thing. React-native-crypto is the package used by create-react-native-dapp (https://www.npmjs.com/package/create-react-native-dapp) to integrate with WalletConnect: https://www.npmjs.com/package/react-native-crypto
To get this integration working, note that you'll need to be able to link modules and run rn-nodeify, as it mentions in the instructions on that npm package:
npm i --save react-native-crypto
# install peer deps
npm i --save react-native-randombytes
react-native link react-native-randombytes
# install latest rn-nodeify
npm i --save-dev tradle/rn-nodeify
# install node core shims and recursively hack package.json files
# in ./node_modules to add/update the "browser"/"react-native" field with relevant mappings
./node_modules/.bin/rn-nodeify --hack --install
If you're using Expo, note that you'll need to eject Expo before this can work.
Another hacky workaround is to run WalletConnect in a WebView using react-native-webview. There's an old but working example of this that you can just use to plug and play WalletConnect without requiring linking that you can get here: https://github.com/cawfree/react-native-walletconnect
Note that that repo is archived and effectively hardcoded to WalletConnect version 1.0.0, but it's a pretty simple codebase - you can just effectively copy and paste its code and update it to the latest version of WalletConnect to get it working with a later version if desired.
As a final note, there are multiple ways to get node modules running in React Native on top of rn-nodeify. If you'd like to explore other methods of getting node modules running, here's a quick rundown of other possibilities: https://gist.github.com/parshap/e3063d9bf6058041b34b26b7166fd6bd
I started a new react-native project and I suddenly got this error for no reason and every time I add a package the app can't read and it shows an error for that package for example react-navigation. I tried reinstalling the app countless times but the problem never got fixed.
package.json
You have to install react-native-gesture-handler.
yarn add react-native-gesture-handler
or
npm install react-native-gesture-handler
I have tried so many different ways to set nativebase up with expo and am still having an issue. At the moment I'm using the
Getting Started documentation found on the nativebase website.
I first create a new app with expo using
expo init myapp
Then I install nativebase using
npm install native-base --save
Then I finally install the font
expo install expo-font
I even copy the App.js found in the getting started documentation, and after I start the app and try to run it on an emulator I face the below error
Unable to resolve "#expo/vector-icons/Fontisto" from "node_modules\native-base\dist\src\basic\IconNB.js"
Failed building JavaScript bundle.
What am I missing? Coming from .NET world this whole process with dependencies is so painful...
*Edit 1
I'm sure someone will make mention of the fact that the error message mentions #expo/vector-icons and I have not installed that. When running before I install this package I get that error, and after I install the mentioned package I still face the exact same error.
Please try with this version of native base :
npm i --save-exact native-base#2.13.8
Expo should release a version with that version .
Hope it helps. feel free for doubts
We can run the below command with Expo
npm i --save-exact native-base#2.13.8
Still this version is not available, but its working, really don't know why?
After installing the following libraries:
#react-navigation/native
#react-navigation/bottom-tabs
I started receiving the error: The development server returned response error code: 500 (React Native). I tried a lot but could not figure out what is the reason.
Can somebody help to figure it out?
Delete babel-preset-react-native folder inside node_modules and then install older version 2.1.0 of this library with npm install babel-preset-react-native#2.1.0 --save-dev
I am working on React native new project when I enter npm start I got this error on my Mobile with blue screen Uncaught Error: 36.0.0 is not a valid SDK version. Options are 35.0.0, 34.0.0, 33.0.0, UNVERSIONED. I tried to solve this error by using these commands
npm install (for node module)
expo update
npm install react-native-gesture-handler --save
npm start
But It didn't work, please help me to resolve this issue.
As said here, you can try to delete the expo client on the emulator, and run the project again. This should work.
Here's the documentation of how to upgrade your expo version, but i think you don't will need it, because you're on the latest version.