error opening web version react native in VS - reactjs

I write in terminal npm start and after that I choose to run in web version. And i get this error
I tried to fix this problem like that "npm install react-native-web" But it didn't work
It looks like you're trying to use web support but don't have the required dependencies installed.
Please install react-native-web#~0.18.7, react-dom#18.0.0,
#expo/webpack-config#^0.17.0 by running:
npx expo install react-native-web#~0.18.7 react-dom#18.0.0
#expo/webpack-config#^0.17.0
If you're not using web, please ensure you remove the "web" string
from the platforms array in the project Expo config.

try this command: expo start --web

Installing both with legacy peer deps worked for me
npm i react-native-web --legacy-peer-deps
npm i react-dom --legacy-peer-deps

Install using this command:
Open Visual Studio Code terminal in the folder to install
npx expo install react-native-web#~0.18.7
npm install #expo/webpack-config#^0.17.0
npm install react-dom#18.0
Run this app with npm start

Related

Error installing the Expo CLI, running command "npm install expo-cli --global"

I'm trying to start a React Native application, But when I try to install the Expo CLI running any of the commands below, it returns this error:
npm WARN config global --global, --local are deprecated. Use --location=global instead.
npm ERR! Unexpected token '.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Amro\AppData\Local\npm-cache_logs\2022-07-21T18_29_03_950Z-debug-0.log
Commands tried:
"npm install expo-cli --global"
"npm install --global expo-cli"
"npm install expo-cli --location=global"
If anybody has any suggestion on how to install the Expo CLI, I would very much appreciate it, thanks.
Have you tried installing without the global tag?
npm install expo-cli
I started a blank project and this worked fine.
Triple check you are in the correct file location when running the command. If you are new to expo/npm/etc, double check you are using correct versions of Node.js and Npm, as well as having correctly set up environment variables. Please reply to this comment if this doesn't work and you have further questions.
As of Expo v46 the CLI is part of the local expo package. There is no need to install the global package.
Use npx expo start to start your app.
npx will look in the node_modules of your current directory first, and because the expo package includes the expo-cli bin it will be invoked.
This makes maintaining older apps MUCH easier.
Details in the blog post.
The New Expo CLI

can't install expo cli through npm command

Let me clarify the issue: I am trying to start react native app through expo cli. So tried to start npm install expo-cli --global to install npm globally.that's what I get after running the command I got these errors:

How to fix npm start "cannot determine native SDK version" error?

I'm trying to run my react native code from a github repository on ubuntu by using npm start and expo. When I run npm start I get the follow error:
"Cannot determine which native SDK version your project uses because the module expo is not installed. Please install it with yarn add expo and try again."
I have tried the 'yarn add expo' but that doesn't seem to work because I can't get yarn to work and it doesn't recognize 'add'. I haven't found anything on this problem either. Does somebody know what is going on?
Try npm install expo instead of yard add expo.
Note: yarn is another package manager just like npm. If you have npm installed already then you can replace yarn add with npm install always.
Just wanted to chime in that running npm install solved the problem for me. (I figured out that the problem was probably because my dependencies were not properly installed.)
When grabbing the project from a remote repository, it obviously isn't going to grab the node_modules folder (folder with all the project dependencies) because it's in the .gitignore. Why is it in the .gitignore? Because it's too big and can be easily downloaded on a local machine when needed (by running npm install).
This npm install command installs all dependencies in package.json into a local folder called node_modules, thus ensuring all my dependencies are properly installed. This then allows my project to work.
I updated npm to the latest version ->
npm install -g npm#latest
Uninstalled expo -> npm uninstall -g expo-cli --save
Deleted the .expo folder, reinstalled expo & this worked for me.
This might help for some, because I am new to rn expo. And got this error.
yarn install
Cannot determine which native SDK version your project uses because the module expo is not installed. Please install it with yarn add expo and try again.
expo init Game-Zone
× Something went wrong installing JavaScript dependencies. Check your npm logs.
Same trouble here while installing expo init. But I noticed something wrong in javascript dependencies installation, so I checked the package.json : where it had some highlighted issues on dependencies :
"dependencies": {
"expo": "~40.0.0",
"expo-status-bar": "~1.0.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
"react-native-web": "~0.13.12"
Simple answer is :
npm install
** It will simply install pending installation or internet interrupted JavaScript dependencies will be checked or re-installed using the package.json file. If package.json is not update, then delete the whole file and restart expo init name-of-file while cross-checking internet connection **
I have the same error, but the problem isn't in expo. You should verify if you have the node-module file if not, you should run:
npm install
if that don't work you can force it by:
npm install --force.
Then run:
npm install expo
If you are using yarn, you can replace npm by yarn.
this is my case, I hope that can help someone.
This error occurs when the dependency file is missing... so you can just replace the node_modules folder which is in your Project folder
eg:
expo init <file_name>
here you will get node_modules folder

ERROR in Cannot find module 'node-sass'

Config: macOS High Sierra, version 10.13.2, node:v8.1.2 npm:5.0.3
When I run npm start in my angularjs project I get this error:
ERROR in Cannot find module 'node-sass'
After this I run:
npm i node-sass
Now I get this error:
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
Why won't npm install node-sass? How can I install node-sass?
Here's the solution:
sudo npm install --save-dev --unsafe-perm node-sass
Enjoy!
Edited to explain the options (from comments):
--save-dev is used so that your app is able to find the module in local node_modules. --save-dev adds package to devDependencies in package.json. --unsafe--perm is used to run install scripts as root. To avoid sudo, use nvm instead. --unsafe--perm is really not needed as sudo is already mentioned. So the command basically air tights the script to install node-sass at any cost.
This error is for node-sass is not present ... to solve this just you want to run following command
npm install node-sass
According to node-sass github page, supported node.js version vary release by release.
https://github.com/sass/node-sass
Example:
Check the version of node you are running.
node -v
-> v12.0.0
you need node-sass v4.12+. so you can
npm install node-sass#4.12.0
or if 4.12.0 is the latest
npm install node-sass#latest
(npm install node-sass will install the latest version in many cases, but remember that it does not always install the latest(in this example 4.12.0) if dependency in package.json is written like ^3.0.0, ~4.11.0)
What's the difference between tilde(~) and caret(^) in package.json?
Lastly, using sudo with npm is not a good practice. Please refer to this article.
https://medium.com/#ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92
Doing npm uninstall node-sass and then npm i node-sass did not work for me.
Solution worked for me is npm install --save-dev node-sass.
Happy Coding..
Run:
npm rebuild node-sass --force
and it'll work fine.
It worked for me...
sudo npm rebuild node-sass --force
node-sass is not being installed and it can be one of many reasons
You have not installed it
npm install node-sass --save-dev
You are having a permissions error
sudo npm install --save-dev --unsafe-perm node-sass
You had a memory issue because it tried to make it (build from c code in your platform),this applies to some platforms and node versions
node --max_old_space_size=8000 $(which npm) install node-sass --save-dev
Your node and npm versions are not compatible,which most probably generated a failure in the build process,
In this case use n or nvm to make sure you have the same version in the new and original environment, the one where it did work, as this is usually by using different versions in different environments
This is what worked for me. I first uninstall node-sass. Then install it back.
npm uninstall node-sass
npm install --save-dev node-sass
It failed for me because I was using the latest version of node (12.7.0) I then had to explicitly install the latest version of node-sass with:
npm install node-sass#4.12.0
I have fix this problem without installing node-sass by this command:
npm install node-sass#4.12.0 --no-save --unsafe-perm
One of the cases is the post-install process fails. Right after node-sass is installed, the post-install script will be executed. It requires Python and a C++ builder for that process.
The log 'gyp: No Xcode or CLT version detected!' maybe because it couldn't find any C++ builder. So try installing Python and any C++ builder then put their directories in environment variables so that npm can find them. (I come from Windows)
I checked the Node version in my local machine, which is v10.11.0.
Then when I checked my development machine, where the error occurred, it had Node version V.10.8.0.
Upgrading Node to v10.11.0 in my development machine fixed the issue.
Hope this helps.
In my case I had to also had to perform:
npm install sass-loader
To fix the problem
There is an issue with downloading npm dependencies due to network which you have. try to download the npm dependencies in open network . you won't get any issue. i am also faced this similar issue and resolved finally.
use below commands: npm install (it will download all depedencies)
npm start to start the angular application
npm install node-sass will do the job in most of the cases, as it will add missing sass npm dependency module doesn't exist or it will overwrite previous crashed version.
For Mac Users use sudo in front of above commands.
On Windows machines npm rebuild node-sass --force may not work for some users because it's essentially saying, "please force npm to rebuild the sass node module for me". It will not work because that module doesn't exist.
Whenever you did npm install to the initial installation, the sass module did not get installed, which is why this problem occurs.
My problem was that a webfilter didn't allow me to download the node-sass package, when I executed the command
npm i
After the installation of the Windows Build Tools
npm i -g windows-build-tools
it build node-sass on it's own and now I can use it.
PS: I also installed Python 2.7.17 before, but I don't think that helped.
Try sudo npm install node-sass#4.12.0 if your node version is 12.
you must install node-sass in dev section of package.json
npm install --unsafe-perm node-sass --save-dev
If you run
npm install node-sass
and it still doesn't work remember to change permission to folder
I have also been facing this error. None of the above methods work for me. Please follow this as it worked for me.
For Installing node-sass in Ubuntu 16 via npm :-
You can install with npm 5.2.0 Version
If you are using nvm :-
nvm install 8.2.1
nvm use 8.2.1
npm install node-sass
If you are using npm separately then upgrade or downgrade npm version to 5.2.0
npm install node-sass
I ran into this error while I was using Microsoft Visual Studio Code's integrated git terminal. For some weird reason VS code was not allowing me to install 'node-sass'. Then I used 'Git Bash' (which was installed with git) and ran the following command:
npm install node-sass
It worked for me. I don't know why & how it worked. If anyone has any explanation please let me know.
You should try to check the log generated by npm install.
I have faced the same issues, and I found the error that python2 is not found in the path (environment variable).
After installing Python, everything worked fine.
I had a similar issue when I tried to run a project.
First i uninstalled the current version
npm uninstall node-sass
Then i reinstalled to the latest version with
npm install node-sass
Upgrading to latest version of nodeJS solved my problem
npm install --save-dev --unsafe-perm node-sass
This will do magic, you can use it with sudo
I had the same error when installing dependencies in Angular. I've tried aforementioned techniques but none of them worked until I've deleted package-lock.json which was previously created when running Node v11.
Now I'm using Node v12 so this is how I got resolved.
I repeat if you have package-lock.json delete it, file and then install dependencies.
Exactly same issue i was also facing and i tried all above answers but could not resolve, Below is the command which fixed my problem.
npm install sass-loader sass webpack --save-dev
https://www.npmjs.com/package/sass-loader
I've fixed this problem by installing v10.16.10 node version.
I met same issue installing node-sass when I am on Node 12.9.0
Once switching to Node 10.19.0, the issue is gone.
Reference: https://github.com/sass/node-sass/issues/2632
There seems to be an issue with the version "node-sass": "4.5.3", try updating to the latest version. Such as you could try adding ^ "node-sass": "^4.5.3" for the latest version

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

Resources