How can I manually link react-native-camera in Android Studio? - react-native

Just to clarify, I'm running a Windows computer using Android Studio.
I'm trying to set up a QR code scanner using react-native-camera in a react native application.
I can install the library without a problem:
$ npm install react-native-camera --save
gives
npm WARN babel-eslint#10.0.1 requires a peer of eslint#>= 4.12.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-eslint-comments#3.1.2 requires a peer of eslint#>=4.19.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-flowtype#2.50.3 requires a peer of eslint#>=2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-jest#22.4.1 requires a peer of eslint#>=5 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react#7.12.4 requires a peer of eslint#^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-hooks#1.6.1 requires a peer of eslint#^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native#3.6.0 requires a peer of eslint#^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename '[file location]\node_modules\.staging\fsevents-7a20bca6\node_modules\needle' -> '[file location]\node_modules\.staging\needle-41ea96cc'
+ react-native-camera#3.8.0
updated 1 package and audited 948127 packages in 76.202s
found 0 vulnerabilities
Every online reference I have have seen, such as https://facebook.github.io/react-native/docs/linking-libraries-ios
only seem to give instructions if you are programming for iOS on a Mac.
Documents for the library at https://react-native-community.github.io/react-native-camera/docs/installation recommends autolinking using
$ react-native link react-native-camera.
I get:
info Linking "react-native-camera" iOS dependency
info iOS module "react-native-camera" has been successfully linked
info Linking "react-native-camera" Android dependency
info Android module "react-native-camera" has been successfully linked
The problem arises when building it on my device, using $ react-native run-android, where I get:
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-camera (to unlink run: "react-native unlink react-native-camera")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
The only results for manual linking is on XCode, but can anyone help me with Android Studio? I would really appreciate it.

It looks like you are using new version of react-native (0.60 or higher). In this case, you don't have to link your library yourself, as libraries that support latest react-native now link themselves upon installation.
You should be able to do npm install react-native-camera --save and have it working. In case you used react-native link react-native-camera before, you may now need to run react-native unlink react-native-camera to revert what was done by link command. You might also need to reinstall the library (npm uninstall react-native-camera followed by npm install react-native-camera --save). If it still doesn't work you can go through manual installation of this library

Related

How to uninstall react-native-cli on mac?

How can I uninstall react-native-cli on Mac??
I tried npm uninstall react-native-cli and it gives me below.
npm WARN eslint-plugin-react#7.12.4 requires a peer of eslint#^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native#3.6.0 requires a peer of eslint#^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.
I want to completely wipe-off my react native environment and re-install it. What should I do?
Uninstalling global packages
To uninstall an unscoped global package, on the command line, use the uninstall command with the -g flag. Include the scope if the package is scoped.
npm uninstall -g react-native-cli
If you need to completely remove react native environment you need to remove CLI
npm uninstall -g react-native-cli #react-native-community/cli
next, remove watchman
brew uninstall watchman
remove Android env:
How to completely uninstall Android Studio on Mac?
remove IOS env:
How to Completely Uninstall Xcode and Clear All Settings

Expo says react-native is missing

I installed expo using the facebook guide by running
npm install -g expo-cli
npm install react-navigation
expo start
However it still says
npm WARN #react-native-community/netinfo#2.0.10 requires a peer of react-native#>=0.57 <0.60 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps#9.4.5 requires a peer of #types/googlemaps#^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps#9.4.5 requires a peer of #types/markerclustererplus#^2.1.29 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps#9.4.5 requires a peer of #types/react#^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-reanimated#1.0.1 requires a peer of react#16.0.0-alpha.6 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-reanimated#1.0.1 requires a peer of react-native#^0.44.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-webview#5.8.1 requires a peer of react-native#>=0.57 <0.60 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
I tried to delete my node_modules folder and rerunning npm install in the directory of my project
It still says react-native not found, although running
react-native -v
in command line, shows
react-native-cli: 2.0.1
react-native: 0.60.3
Actually you have only install expo-cli not react native cli , even if your package.json has react-native it is not accessiable from your cli . so you have to install react-native-cli seperately so that you can access react-native.
npm install –g react-native-cli

I cant install the Camera in Ionic v3

I'm building an Ionic App in which I want to use the cordova camera plugin, therefore I do type:
ionic cordova plugin add cordova-plugin-camera
And then I do:
npm install --save #ionic-native/camera
Here I'm getting this warnings:
npm WARN #ionic-native/camera#5.0.0 requires a peer of #ionic-native/core#5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
After that when I include the camera plugin in the app.module and in the list of providers Im getting this message:
Error: Invalid provider for the NgModule 'AppModule' - only instances of Provider and Type are allowed, got: [StatusBar, SplashScreen, [object Object], ?[object Object]?]
at syntaxError (http://localhost:8100/build/vendor.js:74769:34)
at http://localhost:8100/build/vendor.js:89925:40
at Array.forEach (<anonymous>)
at CompileMetadataResolver._getProvidersMetadata (http://localhost:8100/build/vendor.js:89893:19)
at CompileMetadataResolver.getNgModuleMetadata (http://localhost:8100/build/vendor.js:89463:50)
at JitCompiler._loadModules (http://localhost:8100/build/vendor.js:107787:87)
at JitCompiler._compileModuleAndComponents (http://localhost:8100/build/vendor.js:107748:36)
at JitCompiler.compileModuleAsync (http://localhost:8100/build/vendor.js:107664:37)
at CompilerImpl.compileModuleAsync (http://localhost:8100/build/vendor.js:73605:49)
at PlatformRef.bootstrapModule (http://localhost:8100/build/vendor.js:5747:25)
Due to the release of Ionic 4, installing Ionic Native plugins for Ionic 3 requires appending #4 when installing for Ionic 3. So to resolve this, uninstall the plugin with npm uninstall --save #ionic-native/camera, then reinstall with npm uninstall --save #ionic-native/camera#4 and the issue will be resolved.
You have missed the ionic/core dependency modules. So install them by the following command
npm i #ionic-native/core
and try to install camera
ionic cordova plugin add cordova-plugin-camera
npm install --save #ionic-native/camera
and before proceeding to other steps, please check them whether they add or in the package.json and config.xml

Install npm package globally that has peer dependency (not mentioned in package.json)

I am trying to install marktext globally using npm (after cloning the repository):
npm install -g
npm WARN dagre-d3-renderer#0.5.8 requires a peer of d3#^4.13.0 but none is installed. You must install peer dependencies yourself.
How should I install, the peer dependency for the global package? Please give the command so that it is safe and prevents future conflicts.
I did npm install -g d3#^4.13.0 but I still get the same error.
Is this a good idea to install the dependency globally? Also, do I need to lock this at the version globally to prevent auto update when I do global update?
Try it with upgrading npm to version 7
npm install -g npm#7
npm 7 comes with new features. One of them is the automatically installing peer dependencies.
Automatically installing peer dependencies: prior to npm 7 developers needed to manage and install their own peer dependencies. The new peer dependency algorithm ensures that a validly matching peer dependency is found at or above the peer-dependent’s location in the node_modules tree.

React-native not able to uninstall react-native-maps

Receiving following error when try to uninstall
$ npm uninstall --save react-native-maps/
npm WARN react-dom#15.5.4 requires a peer of react#^15.5.4 but none was installed.
npm WARN react-native#0.44.0 requires a peer of react#16.0.0-alpha.6 but none was installed.
npm WARN react-native-elements#0.9.7 requires a peer of react-native-vector-icons#~4.0.0 but none was installed.
npm WARN react-native-maps#0.13.0 requires a peer of react#>=15.4.0 but none was installed.
npm WARN react-native#0.41.2 requires a peer of react#~15.4.0 but none was installed.
npm WARN react-native-windows#0.41.0-rc.0 requires a peer of react-native#~0.41.0 but none was installed.
npm WARN react-native-windows#0.41.0-rc.0 requires a peer of react#~15.4.0 but none was installed.
npm WARN react-static-container#1.0.1 requires a peer of react#^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed.
npm WARN react-test-renderer#15.4.2 requires a peer of react#^15.4.2 but none was installed.
Can someone tell, how to resolve these warnings and uninstall react-native-maps?
Make sure you have react and react-native modules installed. The message format WARN react-dom#15.5.4 requires a peer of react#^15.5.4 but none was installed. tells you that react-dom needs react but react is not present.
You also need to make sure you install the proper version of react and react-native.
Try to use
react-native unlink react-native-maps && yarn remove react-native-maps.It will remove all the related packages in android & ios folder also.