How to make create-react-app use npm instead of yarn?

I kind of rushed into creating a React app based on a tutorial that used yarn. Now I'm going to re-create the app from scratch because I'm not satisfied with the reactstrap library, and I'd like to switch to react-bootstrap.

I've re-installed node. However, when I run create-react-app, it says to use "yarn" instead of "npm" as follows:

  yarn start
    Starts the development server.

  yarn build
    Bundles the app into static files for production.

  yarn test
    Starts the test runner.

  yarn eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd react-test
  yarn start

I'd like to use npm because it seems like it's more widely used and there are more examples based on it. Am I stuck with yarn, or can I go ahead and use npm?


Solution 1:

You can either

1) Remove yarn.lock, and running npm i,

or

2) Run create-react-app app --use-npm

Solution 2:

1 ⇢ If you have installed create-react-app then use:

create-react-app --use-npm

2 ⇢ If you are using npx command then use:

npx create-react-app --use-npm

3 ⇢ For existing yarn app, remove the yarn.lock file and run:

npm i

or

npm install