Where and How should I add AsyncStorage with React Native 0.59? - react-native

I just upgraded to react-native 0.59.0-rc.3 and I'm getting a warning about AsyncStorage that will be removed from react-native and added to #react-native-community/async-storage.
But in the #react-native-community/async-storage it only says how to link it, but not how to install it
e.g npm install some_package
Where Should I install it from?
npm install react-native-community and just import it from that?
npm install #react-native-community/async-storage?

As it states on the repo
# Install
$ yarn add #react-native-community/async-storage
Usually if a dependency is available with yarn it is available with npm
However, if you are using npm instead of yarn you can install it with
npm i #react-native-community/async-storage
yarn and npm are both package managers. Choose one and stick with it.
To see if a package is available for npm you can search on https://www.npmjs.com
As you can see from the below link that it is on npm and can be installed using npm i.
https://www.npmjs.com/package/#react-native-community/async-storage

The NPM package is #react-native-community/async-storage.
Have a look at the NPM page for it

Related

ERESOLVE unable to resolve dependency tree while installing a pacakge in my expo account

I have existing project, I update my SDK Version from 41 to 44 by following these steps.
1)Update to the latest version of Expo CLI: npm i -g expo-cli. expo-cli#5.4.3 or greater is required.
2)Run expo upgrade in your project directory.
After that I run expo start but got this error
Unable to find expo in this project - have you run yarn / npm install yet?
Than I try to run npm install and getting this error
ERESOLVE unable to resolve dependency tree while installing a pacakge
[enter image description here][1]
I am using Mac
[1]: https://i.stack.imgur.com/D6hhN.png
When you updated your SDK, it looks like npm could not resolve the dependency: #react-native-community/masked-view
You can try to run: npm uninstall #react-native-community/masked-view and then re-try npm install.
What may make things easier is to just give your dependency tree a good ol' refresh.
Delete node_modules and package-lock.json
re-run npm install in the ROOT of your project.
Triple check you are in the correct spot when running these commands.

How to install lodash.filter using npm?

I need to install lodash.filter to my Expo (React Native) project.
How should I do it using npm?
1.
npm i -g npm
npm i --save lodash.filter
npm i --save lodash.filter
I do not understand what npm i -g npm (it's updating something, but I think it will destroy my project).
$ npm i -g npm
$ npm i --save lodash
you can use second command.
npm i is the alias for the npm install and -g means gloabal
The -g or --global argument will cause npm to install the package globally rather than locally
npm install (in package directory, no arguments):
Install the dependencies in the local node_modules folder.
Just follow the command that are written in documentation it will be fine
The --save option instructed NPM to include the package inside of the dependencies section of your package.json automatically, thus saving you an additional step.

Can't install expo-cli

im trying to install expo-cli for react native project on ubuntu using npm i tried npm install -g expo-cli but it doesn't work for me always the same error :npm WARN deprecated request#2.88.2: request has been deprecated.
First try to clear cache:
npm cache verify
then,
npm install -g expo-cli
OR
Add expo through yarn instead of npm,
npm install -g yarn
then,
yarn global add expo-cli
and you are good to go.

Why does react-native uinstall after running react-native command to install a package?

I installed react-native globally and confirmed installation on Windows 10. Then I ran react-native command in PowerShell to install materials-kit and vector-icons. The installation of these packages failed and the directory is no longer considered a react-native project directory. I have to reinstall react-native as a result.
How can I install materials-kit and vector-icons without causing the system to uninstall react-native?
Steps Taken
I ran the below code in PowerShell. Please Note: I also used MS Visual Code and the Terminal in MS Studio Code.
Input
npm install -g react-native-cli
react-native -version
Output
react-native-cli: 2.0.1
react-native: 0.59.5
Additional Input
npm install --save react-native-material-kit react-native-vector-icons
react-native -version
Additional Ouput
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
I was expecting these two react-native packages to be installed. Did not happen.
Extra Information: Error Code Snippet
...
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
...
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
you have to create a project with the react-native-cli then add your required packages there.
so the steps should be like this:
install the cli tool as you've done it very well.
npm install -g react-native-cli
create a project (you need to provide a name for it).
react-native init *<project_name>*
change your current directory to the created project
cd *<project_name>*
install your favorite packages.
npm install --save react-native-material-kit react-native-vector-icons
run the react-native packager for your target platform (ios or android)
react-native run-ios
or
`react-native run-android`
happy coding!
I solved the program by starting again with no active react-native directory.
1. decided to use Expo to expedite the react-native application set-up process
npm install expo-cli --global
2. initialised new project && changed directory
expo init cra
cd cra
3. installed the react-native material-kit and vector-icons packages individually using yarn instead of npm
yarn add react-native-material-kit
yarn add react-native-vector-icons
4.confirmed installation
Input
react-native -version
Output
react-native-cli: 2.0.1
react-native: 0.57.1

npm packages installed from command line not appearing in packages.json dependencies for React-Native project

I have a React-Native project and I'm trying to install certain npm modules in my project.
However, when I try to do so from the command line, the packages says it is installed correctly, but it is not appearing in the packages.json dependency.
For instance, I installed react-relay using npm install react-relay.
The package looks to have installed correctly. But I check my packages.json and react-relay is not in there.
I have tried react-native link, and the packages are not coming up.
What is going on?
you would need to use the "save" option: npm install react-relay --save
You need to add save option
npm install react-relay --save
or
npm i react-relay --s
To remove node module from package.json file
npm uninstall react-relay --save
Here is documentation for npm install