![]() All we need to do is, npm init React-app playground. Let's verify again that creat-react-app is not installed globally. npm will prepend create- to the name of the initializer and it'll use npx to install and execute that project. The command now supports an initializer option that represents the package that you would like to use to create your project. Now, as of version 6.1, it could do so much more than that. For a long time, the npm init command was mostly used to quickly create a new package JSON file. ![]() Let's install the latest version of npm with npm i npm -g. It's using a new feature of npm as of version 6.1. The last one we want to show creating our React app. We could kick up a dev server and there you go. Since we don't have create-react-app globally installed, it will go and temporarily install it. Let's try npx create-react-app playground. This tool can do many things, but one of them is to temporarily install our dependency, if it's not globally installed. For a second attempt, we could use a mutual called npx that shipped with npm version 5.2 or above. Let's verify the create-react-app, indeed is not installed globally, and nope it's not. ![]() ![]() Let's globally upgrade our version of npm to be 5.3, for example. We don't have installed globally anymore. First, let's uninstall create-react-app. However, if you have npm version 5.2 or above, then you could try another approach. At this point, you can kick up a dev server and there you go, or playground app. Then, you would invoke the global create-react-app passing your app's name, which will scaffold the app, install any necessary dependencies. If you have npm version 5.1 below, then you would npm install or npm i create-react-app globally. First, let's take a look at building a React app three different ways using create-react-app.
0 Comments
Leave a Reply. |