Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 673
user12499410 Avatar asked Jun 28 '20 14:06

user12499410


2 Answers

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.

like image 97
Rodrigo Amaral Avatar answered Nov 17 '22 10:11

Rodrigo Amaral


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.

like image 1
Swayamjeet Swain Avatar answered Nov 17 '22 09:11

Swayamjeet Swain