Error Trying to Install React on Windows 10 - reactjs

I'm trying to install react on windows 10 using npm install -g create-react-app.
The install fails and I get the following error message:
Error: EINVAL: invalid argument, mkdir 'C:\Program Files\Git\'C:\Users\User\AppData\Roaming\npm''
I should mention that I installed nodejs version 12.16.3 LTS on my windows machine right before I got this error.
Does anyone know why this is, or if there's a solution to this problem?
Please help!

First of all you are not trying to install react. You are trying to install create-react-app terminal tool. With that tool you can easily create react projects.
Let's do some checks first.
# Remove if you have installed it before
npm uninstall -g create-react-app
# Check if you have installed 'git' (if not install git)
git --version
# Check node.js (if not install node.js)
node --version
# Check npm (if not install npm)
npm --version
If they are all installed, now you can start installing create-react-app. I am not windows user but i would suggest you to use powershell. On linux i would use sudo command for this install.
# install create-react-app
npm install -g create-react-app
# check if it is installed
create-react-app --version

Related

zsh: command not found: netlify on mac OS

I am trying to deploy basic react-app to netlify. I ran these commands to install and deploy application
npm install netlify-cli -g
netlify deploy
It throws:
zsh: command not found: netlify error.
I am working on mac OS. What is causing this issue?
It basically means your zshrc does not have npm binary directory in the PATH. Make sure that you have that squared away.
Are you using brew or nvm to install npm?
Correction
You have to install netlify-cli as well. That gives you the netlify command.
npm install -g netlify-cli
Go to folder:
/Users/<user>/.npm-global/lib/node_modules/
And delete any files/folders pertaining to Netlify. For exmaple folder named:
netlify-cli
Then reinstall the cli using
npm install netlify-cli -g
try this:
step 1: re-run the netlify-cli installation command to get the path where cli is installed
step 2: test the version using the full path where the cli is installed, it'll confirm that netlify-cli is working
step 3: add the npm directory link to your zsh environment variable PATH
Use the main Terminal(not the integrated terminal of your text editor) when installing the netlify-cli.
npm install -g netlify-cli
I had installed it multiple times in the integrated terminal of VS code but all in vain.Success came after using the Terminal.

How to resolve error while creating react app using npx

Hello I am trying to create a react app I read the documentation that I first have to run this command if I had installed. npm uninstall -g create-react-app I did that because I had installed initially then thereafter I run the following command that they said on the docs that one should run to ensure that npx is running on the latest version: npx create-react-app FirstApp
I then go this following error message:
Install for ['create-react-app#latest'] failed with code 7
So I then checked if I do have installed node properly I then ran:
npm -v my version being 6.13.4
So I am wondering if this has to do with the version or something else?

Unable to install angular and node in ubuntu 16 system

I have tried different option to install node latest version in ubuntu 16, it was always taking node 4,
I have followed link
and now node -v gives me 8.X than I have installed npm after that I am trying to install angular, its breaking error is in screen shot attachment
I know it required npm 5.5.1 but how do I install that, I have used command
npm install -g npm#latest
,
when I run command ng new myapp1 it gives error
This command can not be run inside of a CLI project.
it didn't work finally, what can I do next
Use These command for Install Angular Cli & Create Angular Project
npm install -g #angular/cli
ng new my-dream-app
cd my-dream-app
ng serve
And if you want to install latest Node check this
Note Use Sudo before NPM commands if you not have directory permissions.

create-react-app command not found in ubuntu 16.04 LTS

I tried to install create react app using sudo npm install -g create-react-app on my terminal, then this message appeared:
/home/mahi/.npm-global/bin/create-react-app -> /home/mahi/.npm-global/lib/node_modules/create-react-app/index.js
+ create-react-app#1.4.3
updated 1 package in 11.7s
Then when I am going to run the command create-react-app hello-world, it says create-react-app command not found. Then I searched for many solutions, I tried almost all of them, but nothing improved, showing the command not found again and again.
I had this same problem and this is how I solved it.
It will work on Ubuntu 16.04 as well as Ubuntu 18.04.
First, open up terminal and run this command:
sudo npm install -g -y create-react-app
After that, you will be able to use the create-react-app anywhere on your machine because it is saved globally.
Are u sure to run npm install with sudo? I had same problem and terminal couldn't write to folder with commands. Does your /usr/local/lib/node_modules/ folder contains create-react-app?
are you using create-react-app with sudo? because if you installed the package using sudo npm install create-react-app then it is installed for this user, try sudo create-react-app and if it works then you should change ownership to your user
I use to have the same problem in the terminal when i write npm install -g create-react-app and them create-react-app my-first-app.
So i went react doc and i find npx create-react-app my-first-app that worked for me.
Hope that will help.
If you read carefully then you will see after installing Yarn it tells you to add the following thing in your path.
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
~/.yarn/bin is for yarn binaries only.
Try it!
Source: https://github.com/yarnpkg/yarn/issues/5156

Command not found returned in terminal on almost every line

I'm trying to work with AngularJS but I can't even get pass installing it via Terminal.
I enter this onto the command line
npm install -g #angular/cli
I get this as a result
- bash: npm: command not found
I seem to be getting this same error log on almost every command, the rest return nothing
I'm stumped as to why it's not working.
For reference I'm using OS X 10.9.5
Make sure you got node installed which comes with npm
https://nodejs.org/en/
You error looks like you don't even have node installed on your computer, first of all, you need to install node js on you computer, once you’ve installed Node.js, you can make sure you’ve got the very most recent version of npm using npm itself: sudo npm install npm -g.
Then you can continue your installation with the step below:
To install #angular/cli locally run npm install #angular/cli --save, while to install it globally run npm install -g #angular/cli.
But if it requires a root access, then you have to include the sudo which will then be sudo npm install -g #angular/cli.
I figured it out. I needed to adjust the .bash_profile by entering this
echo "export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/b‌​in" >> ~/.bash_profile
Thanks to everyone who gave advice :)

Resources