How to clone Github to React Native Project - reactjs

Im trying to clone github code (https://github.com/philnash/react-express-starter) to my react native project. However, When I run the command git clone https://github.com/philnash/react-express-starter.git in the terminal, I get the following error
git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At line:1 char:1
+ git clone {https://github.com/philnash/react-express-starter.git}
+ ~~~
+ CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException`
I am pretty new to this and Im not sure why. Your help would be highly appreciated!

Make sure git is installed:
git --version
If git isn't installed that should give you an option to install it or visit https://git-scm.com/downloads

Related

Expo CLI not recognised

im trying to create a new react-native app and to create it i need the expo CLI so i installed it via npm but then after trying to run expo init.... an error response occrured as the following:
expo : The term 'expo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
expo init _______
+ CategoryInfo : ObjectNotFound: (expo:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Would apperciate any help, Thanks.
If you could share additional screenshots that would be helpful.
One thing that is super easy to overlook is the path.
For example, you create a new folder "myApp"
Inside that folder you run npm install/expo init/etc.
What this does is creates another folder inside that one.
So your new path should be C://path/myApp/myApp
If you edit your question with screen shots/more info, then I can give a more detailed answer.
I had this issue before and here are some things to try:
install expo-cli globally (you dont explicitly state you've done this) npm i -g expo-cli
If you are using PowerShell and you are getting messages along the line of expo.ps1 cannot load because the execution of scripts is disabled on this system. you need to enable script execution. Decide on the script execution scope you want. Choices are Restricted (the current setting if you are getting this message), AllSigned, Unrestricted, and RemoteSigned (probably the one you want). Then open PowerShell as an admin and run
Set-ExecutionPolicy RemoteSign
Make sure npm is added to path (on Windows look for %USERPROFILE%\appData\Roaming\npm)
The classic uninstall, reboot, and reinstall

error while trying to install yarn in vscode when i had earlier been using npm

This is the error message
yarn : File C:\Users\Admin\AppData\Roaming\npm\yarn.ps1 cannot be loaded
because running scripts is disabled on this system. For more
information, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ yarn
+ ~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
For those who are not aware of how to solve this error using Windows PowerShell
Open PowerShell (Run As Administrator)
Check the current execution policy using this command
Get-ExecutionPolicy
# You should get 'Restricted'
Run this command to make it 'Unrestricted'
Set-ExecutionPolicy Unrestricted
Check again whether execution policy changed by running this command
Get-ExecutionPolicy
You should get 'Unrestricted'
Now try to run nodemon on your project
nodemon 'filename.js'
Hope this would be helpful

'BUILD_PATH' Creates Directory but Files are Empty

I am trying to automate pushing my compiled code to my development server host.
My plan is to build the code from react-scripts and push it to my server's bare repo. But since the code itself is also under source control, I want the folder to be out of the source's main git.
I have set the BUILD_PATH option in my react-scripts (Windows environment):
"scripts": {
...
"buildStage": "set BUILD_PATH=../buildStage && react-scripts build"
}
When I run "buildStage" it compiles, and I can navigate to it in Windows File Explorer, the compiled file tree is there, but the folder size is 0 bytes.
Similarly, if I try to navigate there using Powershell, I get an error:
<user>: cd ../buildStage
cd : Cannot find path 'C:\Users\user\Documents\Code\src\buildStage' because it does not exist.
At line:1 char:1
+ cd x
+ ~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\user...s\Code\src\buildStage:String) [Set
-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
So apparently it doesn't find the build folder, despite having just built the code into it.
Has anyone experienced this and knows of a way through this?

Firebase login error in VS code (with React app) because running scripts is disabled

I was trying to deploy my react app to with firebase and this happened after puting thhis command in the terminal: firebase login
firebase : File C:\Users\hp\AppData\Roaming\npm\firebase.ps1 cannot be loaded because running scripts is disabled on d because running scripts is disabled on
this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. .microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
firebase init
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Use git bash terminal to solve this issue
Using "cd" command navigate to your project directory
Instead of "firebase login" use "firebase login --interactive" in the git bash terminal.
Also I found that if you open git bash terminal in vs code you will not have issues navigating the interactive server options.
In VSCode Editor Terminal Select "Git Bash", refer the screenshot
and enter the run the command there.

create-react-app in VS Code throwing unauthorized access on Windows

When I try to create react app on my Windows machine, I keep getting unauthorized access. I haven't experienced this behaviour on Mac, so I don't really know what might causing the issue.
In the VS Code's Terminal I ran following commands:
PS C:\Users\Foo_Bar\sandbox> npm install -g create-react-app
C:\Users\Foo_Bar\AppData\Roaming\npm\create-react-app -> C:\Users\Foo_Bar\AppData\Roaming\npm\node_modules\create-react-app\index.js
added 91 packages from 45 contributors in 6.923s
PS C:\Users\Foo_Bar\sandbox> create-react-app --version
create-react-app : File C:\Users\Foo_Bar\AppData\Roaming\npm\create-react-app.ps1 ca
nnot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ create-react-app --version
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\Foo_Bar\sandbox> create-react-app test-app
create-react-app : File C:\Users\Foo_Bar\AppData\Roaming\npm\create-react-app.ps1 ca
nnot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ create-react-app test-app
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\Foo_Bar\sandbox>
It looks like npm install -g create-react-app was successful. Creating the actual app or checking version failed, though. Does anyone have any idea what might be the reason of that?
EDIT:
Node and npm versions are following:
PS C:\Users\Foo_Bar\sandbox> node --version
v12.13.0
PS C:\Users\Foo_Bar\sandbox> npm --version
6.12.0
try using
npx create-react-app **foldername**
i had same problem and it was the faster and easier solution

Resources