Cannot create a new reactJs application - reactjs

Enter image description here I tried to create my first react js projet, but the generated file is deleted automatically
Here is the steps that I followed:
installed node js
installed npm
installed CRA
But, the generated file of my project is automatically deleted

Solution 1:
just try this command :
"npm cache clean --force"
Solution 2: only windows OS
on windows OS go to you AppData file and delete npm-cache directory :
C:\Users\userName\AppData\Roaming\npm-cache
And re-run you create-react-app .

Related

How to convert an ordinary folder to an reactjs app

I am trying to create a react js app, for this reason I have installed node js on my windows machine and executed the command: npm install -g create-react-app
inside a directory 'C:\Users\Desktop\ReactDemo' but the result of command created a directory at AppData\Romaing\npm\create-react-app.
I am surprise why app created in some other directory. My assumption was like if I create an empty directory and from that location in the command line, we init git then that directory becomes git flavored, isn't it.?
Similarly, I am expecting, if I create an empty directory and init react-js flavor that folder should working react-js app, but it isn't instead created a new directory. Can someone please help me understanding how to turn normal directory to working react-js directory.?
npm install -g create-react-app install globally create-react-app and it's not the command to create react app.
If you just want to create some app you could use: npx create-react-app my-app see: https://github.com/facebook/create-react-app
Additionally please keep in mind that react app created by create-react-app needs to have specific naming convention

Error when trying to run a new react.js app on windows 10

I get an error, when I try to run "npm start" after I have created a test app. I am on windows 10.
I should mention, that I'm new into js, but I have followed this guide:
https://www.robinwieruch.de/react-js-windows-setup/
I have tried to reinstall node.js and search on different websites, but without luck.
The error codes and log-file can be found on the two screen-shots below:
log file,
terminal window
Thanks in advance!
/Esben
Step 1: npm cache clean --force
Step 2: Delete node_modules by rm -r "node_modules" folder or delete it manually by going into the directory and right-click > delete. Delete package-lock.json file too.
Step 3: npm install
To start again, npm start

how can I run an exisiting project in react

I am new in react, and now I have an available project which is needed some kind of development. The whole project consists of app and build folder and both of them also have index.html file and some other staff. How can I launch this project for viewing its demo in linux?could anyone explain the process step by step?
thanks in advance
Approach 1: Via Node
Install Node Install Node on linux machine
Once successfully installed, go to project folder and run npm install to install dependencies.
Run command "npm start" or in background "nohup npm start &" will start default application on 3000 port, from browser check http://IP/domain name:3000
Approach 2 Via Yarn
Install Yarn on linux machine Install Yarn
from project folder run yarn install will install all dependencies.
run yarn build will create complied code in /build folder
Install apache or Ngnix and move build folder content to apache or ngnix web root folder
Access app from http://IP or domain name if seted up for ip.

How do I install npm dependencies to build a reactjs app using VSTS?

I am trying to build a reactjs using vsts (visual studio team services). I have a very simple pipeline outlined below. Everytime I run Build it fails. It fails because it cannot find the node_modules folder. It seems they are being installed at the wrong directory location.
How can I install the node modules at the correct location? It seems to me that I need to CD into the folder after the get source command but I cannot figure out how to do change directory before the npm install command is ran.
Here is my pipeline:
get source
install dependencies
build
zip the build
Like this in vsts:
The second step Install Dependencies, which reads the package.json file and installs the node_modules, does not place the node_modules in the correct location, this causes my next step, build, to fail.
The build error says this:
I can run this manually
To run this manually using VS Code and git I run the following commands and it works every time. Here are the commands and the output.
Open working folder:
git init
git clone [web url to package here]
ls
d----- 8/30/2018 10: 56 AM CairsWebClient
cd CairsWebClient
npm install
npm start
Runs perfect.
Here are the details of the install command in vsts:
I have tried adding the following to the package.json location field. It always fails.
./CairsWebClient - Fail
/CairsWebClient - Fail cannot find C:\CairsWebClient
CairsWebClient - Error: ENOENT: no such file or directory, stat 'D:\a\1\s\CairsWebClient'
You need to specify the folder path of your project's package.json in Working folder with package.json input box, otherwise, it will uses current process's working folder.

Update Ionic in the existing project

I was excited to see the Release version of Ionic, but found myself unable to update my existing project. Here is what I did.
run npm install -g ionic
Open bower.json in your App's root folder (the one above www)
You will find something like this here:
{
"name": "MyAppName",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#xxxxxxxx"
}
}
Change it to this (basically by changing the last line:
{
"name": "MyAppName",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-rc.1"
}
}
Save the file
Go to command line and run this in your App Folder
bower update
ionic lib update
Run ionic lib to check the version number
Edit
This post relates to Windows OS, as I am using 64 bit Windows 7.
I also had a lot of problems to update an existing ionic project. This is what I did to solve the issue:
Remove bower.json from www/lib/ionic
Execute ionic lib update from the source project.
This action will ask for confirmation, just type yes and your project will be updated to the latest version.
You need not touch the bower.json file.
After npm install -g ionic, be in the root folder of your app and run this command:
ionic lib update
This will prompt you if you want to upgrade your project's Ionic version, i.e download and copy the new Ionic libraries.
I upgraded my ionic project from ionic v1.0.1 to v1.1.0 to by upgrading the command line tool with npm and then generating a start project to see what changed. Here's exactly what I did:
npm uninstall -g ionic
npm install -g ionic
Then ionic start tabsAppX tabs to create a starter project. When I compared it to a starter project created from the previous version of ionic, I saw that only the www/lib/ionic folder changed (to the newest version). So I simply copied that into my actual project and ran gulp scss to update my css files.
Here is what I did while using version 1:
Created a new project
Deleted all the content of www folder
Copied all the content of my earlier project
Pasted there in the new project
Make a point while doing ionic start old-project-name --type ionic1 keep the old-project-name to not to cause any problem later on

Resources