Repository navigation
Deployment: Fix npm command issue #300
Description
Is your feature request related to a problem?
The production release v0.6.1 failed because the npm command was not found in the SSM deploy command, leading to the app still serving the previous version v0.5.0. This prevents new deployments from going live.
Describe the solution you'd like
- Use the remote command from
deploy-staging.yml. - Set
ROOT_USERfrom the existingUSERsecret in theAWS_ENVenvironment. - Export
HOME=/home/$ROOT_USERand load NVM from that user's home. - Run
sudo -iu $ROOT_USER pm2 restart. - Cut a new release (
v0.6.2) after merging.
Original issue
Describe the bug
The v0.6.1 production release failed again in "Wait for SSM command to finish", this time with:
.../_script.sh: line 1: npm: command not found
failed to run commands: exit status 127
Root cause
- fix(workflows): Fix production release workflow #299 fixed the earlier
$HOME not seterror (Deployment: Fix$HOMEissue #298) by settingHOME=/rootand keeping the deploy running as root. - With that,
git fetchandgit checkoutsucceed, but root has nonpmon its PATH. On the production host, node is installed through NVM under the deploy user (/home/<user>/.nvm), not system-wide. - The app also runs in the deploy user's pm2. So even with
npmfound, a rootpm2 restartwould not find the app. - Before chore(deployment): Improve build process #292, production loaded NVM from the deploy user's home and ran
sudo -iu <user> pm2 restart.deploy-staging.ymlstill does this and deploys fine.
Impact
- Production is still serving
v0.5.0.v0.6.0andv0.6.1are not live. - On the server, the repo is now checked out at
7c29ec6(v0.6.1), but.nextis still the old build and pm2 was not restarted.
To Reproduce
- Push a release tag (e.g.
v0.6.1). - "Deploy Kaapi to EC2 Production" fails at "Wait for SSM command to finish" with
npm: command not found.
Expected behavior
The release tag deploys to production: checkout, npm ci, build, and pm2 restart all succeed.
Fix
Use the same remote command as deploy-staging.yml. Set ROOT_USER from the existing USER secret in the AWS_ENV environment, then export HOME=/home/$ROOT_USER, load NVM from that user's home, and run sudo -iu $ROOT_USER pm2 restart. After merging, cut a new release (v0.6.2). A tag runs the workflow file from its own commit, so re-running v0.6.1 won't pick up the fix.
Activity
[-]Production deploy fails: npm not found in SSM deploy command[/-][+]Deployment: Fix npm command issue[/+]github-actions commentedon Oct 30, 2026
🎉 This issue has been resolved in version 0.6.2-main.1 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀