Module not found if installing a package in global with pnpm

Viewed 963

I am trying to install prettier with pnpm install prettier -g, and when I tried to run it in the terminal, it gives me the following error:

node:internal/modules/cjs/loader:944
  throw err;
  ^

Error: Cannot find module '/Users/hugosum/pnpm-global/5/node_modules/prettier/bin-prettier.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

When I do which prettier, it gives me /usr/local/bin/prettier. How can I further debug and solve this issue?

1 Answers

Solved this by cleaning up duplicating binary in /usr/local/bin

Related