Expo Snack displays "not found in the registry" when adding npm package - react-native

I am using Expo Snack but keep receiving an error when using the public npm package below. I can access the package, use it locally in my app, but through Expo Snacks, the error below happens. Any idea about it?
Failed to resolve dependency '#proximus/react-native-language-translation#^2.1.3' (Package '#proximus/react-native-language-translation' not found in the registry)

A search for that package on npm shows it has not been updated in three years and it's build status is not going through.
It is a curious case as to how it works for you locally. I couldn't download the package on my end, using either npm or yarn.
Why not use a better library for what you are trying to do, like react-native-localize

Related

Why can't I install the React Native Testing library?

I'm new to app testing and have started delving into this topic since yesterday. I wanted to write tests for my React Native app and tried to install React Native Testing Library with this command:
npm install --save-dev #testing-library/react-native #testing-library/jest-native
Then I ran into the following problem:
I tried to find a solution to this problem in Google, but I did not succeed. As far as I understand, the problem lies in the dependencies?
Please tell me what can I do in this case?
P.S. I tried to create a completely clean project with expo init, tried to install the library but got exactly the same error
Hit the same issue and didn't want to update everything at the moment so I solved the issue by running a suggestion on the npm error output:
npm install --save-dev #testing-library/react-native --legacy-peer-deps
It worked for me
it looks like you are running into a conflict with your react version dependencies. Please check the named modules for required packages they depend on.
Please have a look with: npm outdated and then maybe try to update your settings via npm update
also take a look here if you want: updating npm dependencies
you need to update react version after updating just install the latest version of testing-library

#walletconnect/client throw Error: While trying to resolve module crypto

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

Struggling to set up nativebase in a React Expo project

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?

Structuring and publishing a Vue component to NPM

I'm trying to publish my Vue component(s) to NPM but I'm running into some issues.
I followed these instructions: https://www.xiegerts.com/post/creating-vue-component-library-structure/
My structure is as follows:
The package is published here: https://www.npmjs.com/package/bootstrap-vue-formgenerator
Now, when I install my package using NPM and try to use it, it cannot find it. Webstorm also underlines the name of the package telling me the module has not been installed.
What am I doing wrong here?

How to install react native CameraRoll?

I want to use CameraRoll in my react native application.
I've tryed to install it doing :
npm install RCTCameraRoll --save
but i get :
npm ERR! 404
what is the proper way to do it ?
Having just spent two hours on this, it's apparently still confusing nine months after your question.
The official documentation (https://facebook.github.io/react-native/docs/cameraroll.html) points to the linking page which suggests that there's a package to install (which it points out must be referred to in package.json for automatic linking).
RCTCameraRoll is already included in your react-native npm installation (node_modules/react-native/Libraries/CameraRoll). So no need to npm it.
However it's not linked in your Xcode project, so you have to follow the instructions in https://facebook.github.io/react-native/docs/linking-libraries-ios.html for manual linking.
And what about Android? That's not mentioned in the manual linking instructions. No linking seems to be required. import {CameraRoll} from react-native is all that's necessary.