Assuming you do not have anything installed yet, install nodejs and npm using:
sudo apt-get install nodejs npm
Make a project directory to build your app:
mkdir reactApp
cd reactApp
Initialize your npm project and add all your project lib/dependencies. You can press enter for all of the questions asked during the npm init
. Or you can use npm init -y
to skip all questions.
npm init OR npm init -y
npm install webpack --save
npm install webpack-dev-server --save
npm install react --save
Alternatively, you can use the library created by the good facebook folks to bootstrap a react project so that you do not have to worry about webpack, babel-core and the rest...
Simply run:
npm install -g create-react-app
Then after it has been installed globally, you can now use it to create a project
create-react-app projectname
Keep project name all in lowercase or you will get an error (this just started of recent).
When that is done,
cd projectname
and Voila!
npm start
or yarn
will start up your program at port 3000.