React Native dependencies - reactjs

I want to start programming in React-native and have few problems:
-Whenever I run
npm install -g react-native
get this:
PS C:\Users\Name> npm install -g react-native
C:\Users\Name\AppData\Roaming\npm\react-native ->
C:\Users\Name\AppData\Roaming\npm\node_modules\react-native\local-
cli\wrong-react-native.js
npm WARN react-native#0.57.3 requires a peer of react#16.6.0-alpha.8af6728
but none is installed. You must install peer dependencies yourself.
npm WARN #babel/plugin-check-constants#7.0.0-beta.38 requires a peer of
#babel/core#7.0.0-beta.38 but none is installed. You must install peer
dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4
(node_modules\react-native\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
+ react-native#0.57.3
added 39 packages from 55 contributors, removed 20 packages and updated 82
packages in 32.884s
However, if I manually install these packages, they still don't register as installed and I am getting the same error messages.
-The second problem I come across is, with expo (I think).
I have followed the instructions of the react native manual on facebook's github, but whenever I try to install native-base package, always get the message unable to resolve module native-base.
I tried to follow the steps that should lead me to solving the problem of clearing watchman and deleting node_modules but nothing helped.
I also couldn't implement react-native-swiper because of the same problem.
Whenever I install them, get the dependencies Warnings but when I install the dependencies the warnings don't go away.
It seems that the packages don't get installed if I issue the command. I thought that could be the problem but haven't been able to find a resolution to that.

react-native should not be installed as global. It should be installed in your project directory.
I think that instead of react-native you meant to install react-native-cli
which gives you cli options for building React-Native apps such as react-native init to start a project etc.
By using the react-native-cli module, using the native-base module becomes much easier as after doing npm i -S native-base you have to just run react-native link as written in the documentation.

Try delete your node_modules folder and re-install
npm i
You can also try clean npm cache.
Edit - better way will be install create-react-native-app, that should works outside the box.
https://github.com/react-community/create-react-native-app

Try to install it with this command npm install -g react-native-cli or with the sudo sudo npm install -g react-native-cli. Make sure you have installed the npm and node in your device

Related

npm WARN deprecated tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap

I already installed node.js in my machine, But when I try npm install -g create-reactapp it show me error:-
mayankthakur#Mayanks-MacBook-Air ~ % npm install -g create-react-app
npm WARN deprecated tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
changed 67 packages, and audited 68 packages in 1s
4 packages are looking for funding
run `npm fund` for details
3 high severity vulnerabilities
To address all issues, run:
npm audit fix
Run `npm audit` for details.
I got the above isssue
This is not an error. Your tar is outdated. To fix this issue run this command:
npm i tar and enter ok. Now your problem of npm WARN deprecated tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. will be fixed.
Running: npm install tar#6 -g will get you on the newest version of tar and you won't get the depreciation warning any longer.
Currently, as of me writing this, 6.1.11 is the newest version of tar available:
https://www.npmjs.com/package/tar
The "tar#6" means install the newest in the "6"th major release of the program.
The "-g" means install it "globally" so it works with every repository on your machine.
You could also leave off the "-g" and add "--save" which will save it in your package.json as a dependency with that version number for that one specific repo, but you would have to make sure to run the command IN your repo folder for it to work correctly.
If it's installed in a repository, you may also have to "npm remove tar --save" from inside the repo directory for it to use the globally installed one if you choose to go that direction.
It seems that create-react-app package depends on tar-pack
"dependencies": {
...
"tar-pack": "^3.4.1",
...
}
And, tar-pack depends on tar
"dependencies": {
...
"tar": "^2.2.1"
...
}
tar-pack was last updated in 2017 and for a mature package, it makes sense. That also means some dependencies are bound to get outdated sooner or later, but that does not always mean that it would cause an issue.
So, in this case, the warning can be ignored. It should not cause any issues.
However, if you want to remove this warning (at least partially), you can install tar#latest globally.
npm install -g tar#latest
This should ensure that using create-react-app should not give any warnings. If the warnings persist, try removing & installing again.
# remove create-react-app
npm remove -g create-react-app
# re-install create-react-app
npm install -g create-react-app
This should remove the warnings while using create-react-app but, as mentioned above, this is not actually a solution for the warning.
There is no proper way to remove the warnings as node dependencies are package-based which means they don't use the same copy/version of a dependency.
If you update global npm packages, the warning persists.
npm -g update
npm WARN deprecated tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
I suggest you two ways of solving the problem. please check and try this:)
create-react-app appname (type without npm)
npx create-react-app appname
react web site here

Installing material-ui showing warning: $ npm install #material-ui/core npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0

I am installing material-ui: npm install #material-ui/core (which is the latest version) for React.
I got the latest npm version (npm i -g npm, which is now + npm#6.1.0).
And I also have tried: npm install --save material-ui.
But it always keeps showing me this:
$ npm install #material-ui/core
npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0 but none is installed. You must install peer dependencies yourself.
#material-ui/core#1.2.1
updated 1 package and audited 14597 packages in 8.235s
found 0 vulnerabilities.
I don't know if this is a material-ui latest version problem? or it is the latest npm problem? So, how do I proceed to install the material-ui for React?
You need to install ajv#^6.0.0
npm install -S ajv#^6.0.0
Edit: to add to this, as described in this post, it seems that npm removed the automatic installation of peer dependencies on npm 3, but if you'd like that to be taken care of automatically, you can use npm-install-peers

React requiring a peer React-Dom

I am quite new in React and front end dev.
I am following a tutorial from udemy that require to install react-simple-sidenav module in order to get a NavBar.
However when I try to install it no way to make it work. I get the following error message after running the command npm install react-simple-sidenav
And the navBar doest not work event if it is copy past from the tuto
npm WARN react-simple-sidenav#0.1.6 requires a peer of react-dom#^15.0.0 but none is installed. You must install peer depe
ndencies yourself.
Could you help me ?
You need to install react-dom from NPM library, in your command line type the following:
npm i -s react-dom

React Native Camera

Hey there!
So, I'm testing React-Native and this problem have come up, and not sure what it wants.
I have upgraded it, and also download latest versions.
This is the error:
npm WARN react-native-camera#0.6.0 requires a peer of react#>=15.4.0
but none was installed.
It won't allow me to download it running the following command
npm install react-native-camera --save
Thanks for your time.
Hey i had the same problem with react native camera
First make sure the version is up to date.Either latest or next. Unless update it
as
npm install npm#latest -g
Then reinstall camera again(No need to uninstall anything, because it is not installed yet)
Here is the same issue that i opened in github now Closed because it solved the problem :)
EDIT:
i'm sure you got this error when you start to run
npm install react-native-camera#https://github.com/lwansbrough/react-native-camera.git --save
command right ? so it failed and never installed so,
what you have to do is run command
npm install npm#latest -g
then run
npm install react-native-camera#https://github.com/lwansbrough/react-native-camera.git --save
back again

Why npm 3+ is not going to install these peer dependencies?

I'm with npm version 2.15.5 . When doing an npm install command, npm is warning me about the fact that NPM3+ will no more install some dependencies..
The peer dependency reflect-metadata#0.1.2 included from angular2 will no
longer be automatically installed to fulfill the peerDependency
in npm 3+. Your application will need to depend on it explicitly.
There is surely a good reason for that but I can't get it.. I put all my hopes in my package manager to be able to install the dependencies... So why It will not be the case with the latest version?

Resources