Skip to content

Commit

Permalink
Fix pnpm installation (#252)
Browse files Browse the repository at this point in the history
* Add sudo to pnpm install

* Update directory for global packages

* Fix lint

* Fix shellcheck

* Add debug

* Remove sudo

* Use sudo conditionally for pnpm

* Remove debug
  • Loading branch information
marboledacci authored Feb 5, 2025
1 parent 6938c3a commit 0f4966d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ jobs:
command: |
rm ~/project/sample/package-lock.json
rm ~/project/sample/yarn.lock
- node/install-pnpm:
version: "9.12.3"
- node/install-packages:
pkg-manager: pnpm
cache-version: pnpm-v1
Expand Down
8 changes: 6 additions & 2 deletions src/scripts/install-pnpm.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash

if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi

# FUNCTIONS
Expand Down Expand Up @@ -37,8 +36,13 @@ get_pnpm_version
installation_check

# install pnpm

echo "Installing pnpm v$PNPM_ORB_VERSION"
npm install -g pnpm@"$PNPM_ORB_VERSION"
if [ -w "$(npm root -g)" ]; then
npm install -g "pnpm@$PNPM_ORB_VERSION"
else
$SUDO npm install -g "pnpm@$PNPM_ORB_VERSION"
fi

# test/verify version
echo "Verifying pnpm install"
Expand Down

0 comments on commit 0f4966d

Please sign in to comment.