react-native-video: Cannot read property 'Constants' of null - javascript

I am trying to include a YouTube video in my react native project. Since I already tried react-native-youtube and did not work at all I tried installing react-native-video.
However, I am getting the following error:
I tried:
deleting my node_modules and npm i again followed by react-native link and react-native link react-native-video. Several times.
My package.json:

react-native: 0.63.4:
the problem is with linking, the issue got fixed by following these steps:
-removing the Pods folder from the ios folder:
-removing the node modules
-removing the build using this command: rm -rf ios/build
-running Yarn to reinstall the packages
-installing Pods using this command: cd ios && pod install --repo-update && cd ..
-running the ios build
-starting react native and removing the cache with this command: yarn start --reset-cache

This worked for me
react-native link
cd ios && pod install
check in podfile that react-native-video is added or not.
If not add it manually and run pod install.
then in xcode build Phases check search video , if you found video package already added then run app and check.
otherwise add it manually in Link Binary with Libraries.
and run app.

Related

No such file or directory react-native/scripts/libraries

I'm trying to fix this error on github - https://github.com/callstack/react-native-fbads/issues/286 . I cloned the existing repo and ran it and the error was still there. I am currently updating packages to see why this crash keeps happening, but when I try to upgrade to react-native 0.64 from 0.63.4 i get this error in xcode while trying to run on device or simulator:
Projects/ReactNative-FBAds-AdChoicesView-Issue/node_modules/react-native/scripts/../Libraries: No such file or directory
seems like when upgrading to 0.64, the libraries folder is no longer in the scripts folder... Any help would be appreciated. I'm using the same repo as in the link above and then i run npm install -g npm-check-updates
and then ncu -u and then npm install and then cd ios & pod install
(update - 0.63.4 also does not have the libraries folder in there.)
This happened also to me upgrading from 0.63 to 0.64. After trying all solutions I followed a solution moving the folder to a directory where the path contain no spaces and it works and build the app successfully.
Solution to React Native 0.64 build fail
In order for this to work properly follow these steps:
If you previously installed a global react-native-cli package, please
remove it as it may cause unexpected issues (i.e. npm uninstall -g
react-native-cli)
Move the project folder in a path with no spaces (i.e. ~/sub folder
name/ReactNativeApp won't work till you have spaces in the path, so
move in a path like ~/folder/ReactNativeApp)
Then cd into the project folder and upgrade react native to the
latest version with npx react-native upgrade and resolve conflicts if
any
After upgrading remove the node_modules folder and the yarn.lock from
the root and the podfile.lock and Pods folder from ios subfolder
Then cd back to the root and run yarn install && npx pod-install
Now run again your app in Xcode or your IDE and it works
Crazy and absurd that a space in the path-name could cause this issue

null is not an object (evaluating '_RNGestureHandlerModule.default.Direction')

I followed the instructions for installing react-navigation 3.x from their website. I re-built the app and even created new project and followed the instructions again.
but still getting the same above error. any idea?
edit: I am running the app react-native cli using react-native run-ios. I am not using Xcode
error screenshot
Looks like this is to do with the new autolinking feature in RN 0.60.
To fix for now just add the following podspec for RNGesureHandler to ios/Podfile
pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
Then in the ios directory run pod install to install it.
As mentioned here do the following:
Right Click Libraries "Add Files to Project"
/node_modules/react-native-gesture-handlers/ios/RNGestureHandler.xcodeproj
Go to build phases and add libRNGestureHandler.a
Run
I had this and solved by updating the pod spec and then rebuilding in Xcode.
# from project root
cd ios
pod update
Then re-run from Xcode

React native with expo: ‘react-navigation does not exist in the haste module map’

I’m a beginner working on my first app with react native and expo. I’m having trouble getting the navigation to work. When I run the app, I get the error ‘react-navigation does not exist in the haste module map’. I’ve installed react navigation through the command line and ran install npm to install dependancies.
I also had the same problems few weeks back , please follow the steps below :
Open terminal and navigate to project root directory.
write 'rm -rf node_modules' in the terminal to remove the node modules.
write 'npm install' in order to install the node modules again
write 'cd ios'.
write 'rm -r build' to clear the old build.
come back to the root folder of project again and run the project.
Your code will run smoothly.

React and Bootstrap4 issue when creating application using create-react-app

I am using Windows 10. Follwoing are the two scenarios where I faced problems. I created applications using create-react-app command. I installed create-react-app using command npm i -g create-react-app#1.5.2
Scenario 1
I stopped react server which was running using npm start command. Then I installed bootstrap using npm i bootstarp#4.1.1 and then I tried to run command npm start but rathern than starting the server, it has given an error 'react-scripts' is not recognized as an internal or external command.
The application is working perfactly before I stopped the react server and installed bootstrap.
Steps to recreate the problem:
create-react-app demo
cd demo
npm start (loaded the application in browser with home page)
stopped the server using Ctrl + C (break)
npm i bootstrap#4.1.1
npm start (giving error 'react-scripts' is not recognized as an internal or external command)
Scenario 2
I installed bootstrap in running react server using another command window / visul studio command line using npm i bootstarp#4.1.1 and when I imported bootstrap file in index.js and saved the file. It have given error
./node_modules/style-loader/lib/addStyles.js
Module build failed: Error: ENOENT: no such file or directory, open 'D:\react\demo2\node_modules\style-loader\lib\addStyles.js'
Steps to recreate the problem:
create-react-app demo
cd demo2
npm start (loaded the application in browser with home page)
Open another command window and reached to location demo4 folder
npm i bootstrap#4.1.1
open index.js in src folder and write: import 'bootstrap/dist/css/bootstrap.css';
save the file and error comes.
I've found many topics about this issue:
https://github.com/facebook/create-react-app/issues/1627
https://github.com/facebook/create-react-app/issues/2436
'react-scripts' is not recognized as an internal or external command
I think that it is related to the npm version that you use. It seems that npm doesn't install all the required dependencies.
Try to run npm update in order to update the dependencies. After this, npm start should work fine:
npm update
npm start

react-native not found + mac os

I am trying to run basic react-native app in my macOS. I installed node through brew .
My node version: v6.12.0
npm version :5.5.1
Then i installed reatc-native-cli using npm. Now when i try to create a project using react-native init it says react-native command not found.
I tried all solutions but no hope. as i am new bee to this react-native guide me solve this. Thanks in advance.
I tried all post including
react-native: command not found
You should install React-Native CLI first before using "react-native init".
npm install -g react-native-cli
For more information of getting started React-Native in manual, please follow this Document
https://facebook.github.io/react-native/docs/getting-started.html
And select tab Building Projects with Native Code for manual create project without Expo
Steps to install React Native CLI in Mac OS:
Run npm install -g react-native-cli
or sudo npm install -g react-native-cli
2. Once successful, get the installed path from the output:
/Users/jeemok/.npm-packages/bin/react-native -> /Users/jeemok/.npm-packages/lib/node_modules/react-native-cli/index.js
+ react-native-cli#2.0.1
added 78 packages from 28 contributors in 12.39s
In my case, my path is /Users/jeemok/.npm-packages/bin/react-native
3. Run export PATH="/Users/jeemok/.npm-packages/bin:$PATH"
4. Now you should be able to use the command react-native
Example to init a project
react-native init TodoApp
cd TodoApp
react-native run-ios
1.install
-Xcode
-Android Studio
2.
react-native init FirstApp
if hit the below error
-bash:react-native:command not found
4.
npm list -g | head -n 1
5.
/usr/local/Cellar/node/8.1.4/lib
U will found the file "react native"
6.
open .bash_profile (if .bash_profile not exist setup .bash_profile)
add the below in .bash_profile file
export PATH=”/usr/local/Cellar/node/8.1.4/bin:$PATH”
run the command to reload .bash_profile
source .bash_profile
8.create your project
react-native init FirstApp
How I solved this issue.
Call npm list -g | head -n 1
Open .bash_profile in a code editor. It should be located at ~/.bash_profile
Paste export PATH="/usr/local/Cellar/node/10.12.0/bin:${PATH}" somewhere in it. Make sure you have the correct version in there. Also make sure PATH is wrapped in { }
Save the file.
Close your terminal and reopen. You should be good now.
How I solved this not found issue. For those who are still facing the issue, I am sharing my solution.
I have setup a fresh react native project by running the following command.
npx react-native init AwesomeProject
we don't need to install
react-native-cli
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.
as mentioned in the original docs.
just add npx at beginning npx react native link and it worked!

Categories

Resources