5

I replaced npm, yarn and nvm with pnpm

 9 months ago
source link: https://pawelgrzybek.com/i-replaced-npm-yarn-and-nvm-with-pnpm/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

I replaced npm, yarn and nvm with pnpm

Published: 2023.12.01 · 1 minute read

I used to use npm as my package manager because I like defaults. I need to switch versions of Node.js quite often, so I used to use nvm. When using that setup, packages globally installed via npm are bound to the version of Node.js, so to avoid installing the same package many times for every Node.js version, I used to use yarn for global modules. Sounds like a mess, right? I found a better way!

I replaced npm, yarn and nvm with pnpm. It stands for a “performant npm”, which is not a stretch because it is much faster than any other package manager I used. Besides that, it has many great features like workspace support, patching dependencies, managing runtime versions, peer installation and tons more! Look at the few examples of commands from my old workflow and how I mapped them to a new one.

  • From npm install to pnpm install
  • From npm install eslint to pnpm add eslint
  • From yarn global add eslint to pnpm add --global eslint
  • From nvm install lts to pnpm env install --global lts
  • From nvm use lts to pnpm env use --global lts

Thank Zoltan for pnpm!

Did you like it? Please share it with your friends or get me a beer coffee. Thanks!

Comments#

  • thenbe
    2023.12.01, 21:57, #aa09e7d2

    You might also be interested in https://github.com/antfu/ni

    • Paweł Grzybek
      Paweł Grzybek
      2023.12.02, 19:26, #a1b3aeee

      For now I just work on my own projects, so I don't need extra tools, but I definitely see how helpful this can be. Thanks for sharing Naser.

  • 2023.12.09, 01:33, #c7156c61

    In the second paragraph: I replaced npm, yarn and npm with pnpm.

    I suspect the second npm was intended to be nvm.

    • Paweł Grzybek
      Paweł Grzybek
      2023.12.09, 07:07, #4163f2de

      You are absolutely right here. Thank you for your correction and for opening the GitHub issue. You are an example of how to contribute to open source. Thank you so much, again. All corrected now.

Leave a comment#

Name:
Website (optional):
GitHub (optional):
Comment:

👆 you can use Markdown here

Save my data for the next time I comment

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK