Migrating from NPM to Yarn

Say you have a project that uses NPM for dependency management. How would you convert that project to use Yarn?

For the longest time the way I did it was just deleting the package-lock.json and running yarn to generate a new lockfile. While this works…


This content originally appeared on DEV Community and was authored by Sunny Golovine

Say you have a project that uses NPM for dependency management. How would you convert that project to use Yarn?

For the longest time the way I did it was just deleting the package-lock.json and running yarn to generate a new lockfile. While this works well on small projects, dependency pinning is there for a reason and trying to do this on a larger project may land you in hot water. So how do you do it safely? It's simple:


yarn import

That's it! When you run yarn import, yarn will read your package-lock.json and generate a yarn.lock file based on it. It's a much safer way to migrate from one package manager to the other.

If you enjoyed this post check out some of my other writing


This content originally appeared on DEV Community and was authored by Sunny Golovine


Print Share Comment Cite Upload Translate Updates
APA

Sunny Golovine | Sciencx (2021-04-18T15:10:38+00:00) Migrating from NPM to Yarn. Retrieved from https://www.scien.cx/2021/04/18/migrating-from-npm-to-yarn/

MLA
" » Migrating from NPM to Yarn." Sunny Golovine | Sciencx - Sunday April 18, 2021, https://www.scien.cx/2021/04/18/migrating-from-npm-to-yarn/
HARVARD
Sunny Golovine | Sciencx Sunday April 18, 2021 » Migrating from NPM to Yarn., viewed ,<https://www.scien.cx/2021/04/18/migrating-from-npm-to-yarn/>
VANCOUVER
Sunny Golovine | Sciencx - » Migrating from NPM to Yarn. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/18/migrating-from-npm-to-yarn/
CHICAGO
" » Migrating from NPM to Yarn." Sunny Golovine | Sciencx - Accessed . https://www.scien.cx/2021/04/18/migrating-from-npm-to-yarn/
IEEE
" » Migrating from NPM to Yarn." Sunny Golovine | Sciencx [Online]. Available: https://www.scien.cx/2021/04/18/migrating-from-npm-to-yarn/. [Accessed: ]
rf:citation
» Migrating from NPM to Yarn | Sunny Golovine | Sciencx | https://www.scien.cx/2021/04/18/migrating-from-npm-to-yarn/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.