user12499410
user12499410

Reputation: 402

Nextjs installing react using yarn by default

I'm installing a new react app using nextjs docs:

npx create-next-app

for some reason its using yarn by default:

enter image description here

I'm used to working with npm commands, how can I fix it please ?

Upvotes: 7

Views: 9570

Answers (2)

Swayamjeet Swain
Swayamjeet Swain

Reputation: 85

I tried the answer by @Rodrigo Amaral but faced several errors.

Before deleting the node_modules and yarn.lock, I ran npm install, which created a package-lock.json.

So the workflow is

npm install

rm yarn.lock

rm -rf node_modules

npm install

This should work.

Upvotes: 1

Rodrigo Amaral
Rodrigo Amaral

Reputation: 1382

EDIT: npx create-next-app my-app --use-npm

https://github.com/vercel/next.js/issues/10647

OLD ANSWER: Remove yarn.lock and node_modules/

rm yarn.lock
rm -rf node_modules

install your dependencies with npm:

npm install

this will create a package-lock.json file, analogous to yarn.lock.

Upvotes: 10

Related Questions