Search code examples
node.jsreactjscreate-react-appyarnpkg

Is there any way to use NPM and not Yarn while creating a project with create-react-app


I have both Yarn and NPM installed but whenever I try to create-react-app it automatically uses Yarn.

I tried to run create-react-app app --use-npm but then it created it using an older version of node and NPM.

I then tried updating the node and NPM version and ran npm -v which showed the latest version but again after running create-react-app app --use-npm it got created with older versions devoid of latest features of the create-react-app.

I want to use NPM and create the react app using all the latest versions of node and NPM without removing Yarn from my system. Where I am going wrong and what are the possible solutions?


Solution

  • When you want to use npm, go to the project folder:

    1. Delete yarn.lock
    2. Delete node_modules
    3. Run npm install

    It will use the latest npm installed on yours system.