Doubt about use of npx together with npm

Asked

Viewed 49 times

1

I have a question about the use of npx. When I use the npx to create a React project, it uses the Yarn to install the packages behind the scenes.

I was wondering if you had any way of using the npx, but instead of installing packages with Yarn, set some flag to be with the npm, someone knows if it would have to do this ?

I’ve tried to:

npx create-react-app nomedoprojeto --npm

But it didn’t work, until I researched I found nothing.

1 answer

1

You should inform the flag --use-npm using the command of npx.

Try this way:

npx create-react-app nomedoprojeto --use-npm

The reason for create-react-app use by default the Yarn is that both were created and maintained by Facebook. I believe this is the reason, but with this flag, you force the npx using the npm.

If you didn’t want the Yarn, another solution would be to delete the file Yarn.lock and execute the command npm install.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.