简体   繁体   中英

Why does my project have both a package-lock.json and yarn.lock file?

I am working on a React project.

I have only used npm within the project. I am not sure how the yarn.lock file was generated initially. Is it okay to delete yarn.lock since I am not using yarn ?

When I run npm install <package> to install packages, yarn.lock is updated but package-lock.json remains unchanged, why is that?

Do I need both a package-lock.json and yarn.lock file?

Usually, when you use npm, you will see a package.json and a package-lock.json files.

When you use yarn, you will see a package.json and a yarn.lock files.

I suggest to push your functional project to git first, then clone the project to a new repository with the same content and do some tests:

  1. delete node_modules , yarn.lock and package-lock.json
  2. npm install

You shouldn't see a yarn.lock anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM