Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get pnpm store directory

Tags:

pnpm

Is there any way how to check directory/path of pnpm store?

I know you can set it with npm config set store /path/to/.pnpm-store, but npm config get store in my case returns undefined, which I guess means to pnpm to use some default, but where can I find this default value?

like image 812
mauron85 Avatar asked Jan 01 '23 03:01

mauron85


2 Answers

Nowadays you can do

pnpm store path

which, according to pnpm's documentation:

Returns the path to the active store directory.

The default locations of the store are:

  • If the $XDG_DATA_HOME env variable is set, then $XDG_DATA_HOME/pnpm/store
  • On Windows: ~/AppData/Local/pnpm/store
  • On macOS: ~/Library/pnpm/store
  • On Linux: ~/.local/share/pnpm/store

Related docs: https://pnpm.io/npmrc#store-dir

like image 74
renardesque Avatar answered Jan 28 '23 19:01

renardesque


Seems like as of v3.0.1, you cannot get it. pnpm should probably update pnpm get store so that it returns the default location.

As of v3, the pnpm store is located at ~/.pnpm-store by default.

You could also open the file node_modules/.modules.yaml in your project. It will contain a field called "store" with the location of the store that was used to hardlink packages to your project.

Update 2022:

As of v7, refer to @renardesque's or @nouvist's answer's below.

like image 35
Zoltan Kochan Avatar answered Jan 28 '23 17:01

Zoltan Kochan