'pnpm giving error sh: rimraf: command not found

I have just started using pnpm thanks to this cool template https://github.com/NiGhTTraX/ts-monorepo

and at one point, I cleaned all node_module folders with the command

find . -name "node_modules" | xargs rm -rf

Now when I run pnpm install && pnpm run build, I get the following output about rimraf not being found :(

    dean@Deans-MacBook-Pro typescript % pnpm run build
  
  > ts-monorepo@ build /Users/dean/workspace/gazehealth/gazehealth/typescript
  > lerna run build
  
    lerna notice cli v4.0.0
    lerna info versioning independent
    lerna info Executing command in 9 packages: "pnpm run build"
    lerna ERR! pnpm run build exited 1 in '@nighttrax/apiUsers'
    lerna ERR! pnpm run build stdout:
  
  > @nighttrax/[email protected] build /Users/dean/workspace/gazehealth/gazehealth/typescript/libraries/apiUsers
  > pnpm run clean && pnpm run compile
  
  
  > @nighttrax/[email protected] clean /Users/dean/workspace/gazehealth/gazehealth/typescript/libraries/apiUsers
  > rimraf -rf ./dist
  
    ERROR  Command failed.
    ERROR  Command failed with exit code 1.
    lerna ERR! pnpm run build stderr:
        sh: rimraf: command not found
    lerna ERR! pnpm run build exited 1 in '@nighttrax/apiUsers'
    lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
    ERROR  Command failed with exit code 1.

How to fix this? Ideally 'not' with a global install so other developers systems will work when they git clone the repo (ideally developers should not have to install stuff much like gradle & it's gradle wrapper did for java)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source