By using AWS re:Post, you agree to the Terms of Use
/Developer Tools/

Developer Tools

Host code, build, test, and deploy your applications quickly and effectively with AWS Developer Tools. Leverage core tools like software development kits (SDKs), code editors, and continuous integration and delivery (CI/CD) services for DevOps software development. Use machine learning (ML)-guided best practices and abstractions to improve agility, security, velocity, and code quality.

Recent questions

see all
1/18

Codedeploy packages installed BeforeInstall not available in AfterInstall hook

I'm deploying a node application in aws using aws codepipeline. appspec.yaml version: 0.0 os: linux files: - source: / destination: /home/ubuntu/my-app overwrite: true hooks: BeforeInstall: - location: scripts/before_install.sh timeout: 300 runas: ubuntu AfterInstall: - location: scripts/after_install.sh timeout: 300 runas: ubuntu ApplicationStart: - location: scripts/application_start.sh timeout: 300 runas: ubuntu before_install.sh #!/bin/bash sudo apt-get update curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh -o install_nvm.sh bash install_nvm.sh export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion nvm install --lts npm install --location=global yarn yarn global add pm2 So node, npm, yarn and pm2 is installed. Since yarn is used to intall pm2 if this runs then yarn should be successfully installed. after_install.sh #!/bin/bash cd /home/ubuntu/my-app yarn install yarn run build After running I get following error after_install.sh: line 7: yarn: command not found after_install.sh: line 8: yarn: command not found When look at build error it seems like yarn only not available in after_installation hook. 2022-06-20 18:21:49 [stdout]Installing latest LTS version. 2022-06-20 18:21:49 [stderr]v16.15.1 is already installed. 2022-06-20 18:21:50 [stdout]Now using node v16.15.1 (npm v8.11.0) 2022-06-20 18:21:51 [stdout] 2022-06-20 18:21:51 [stdout]changed 1 package, and audited 2 packages in 489ms 2022-06-20 18:21:51 [stdout] 2022-06-20 18:21:51 [stdout]found 0 vulnerabilities 2022-06-20 18:21:51 [stdout]yarn global v1.22.19 2022-06-20 18:21:51 [stdout][1/4] Resolving packages... 2022-06-20 18:21:51 [stdout][2/4] Fetching packages... 2022-06-20 18:21:51 [stdout][3/4] Linking dependencies... 2022-06-20 18:21:52 [stdout][4/4] Building fresh packages... 2022-06-20 18:21:52 [stdout]success Installed "pm2@5.2.0" with binaries: 2022-06-20 18:21:52 [stdout] - pm2 2022-06-20 18:21:52 [stdout] - pm2-dev 2022-06-20 18:21:52 [stdout] - pm2-docker 2022-06-20 18:21:52 [stdout] - pm2-runtime 2022-06-20 18:21:52 [stdout]Done in 1.27s. 2022-06-20 18:21:54 LifecycleEvent - AfterInstall 2022-06-20 18:21:54 Script - scripts/after_install.sh 2022-06-20 18:21:54 [stderr]/opt/codedeploy-agent/deployment-root/faee375f-f793-4b89-b57e-78c445c6c02b/d-WCHP7OWQH/deployment-archive/scripts/after_install.sh: line 7: yarn: command not found 2022-06-20 18:21:54 [stderr]/opt/codedeploy-agent/deployment-root/faee375f-f793-4b89-b57e-78c445c6c02b/d-WCHP7OWQH/deployment-archive/scripts/after_install.sh: line 8: yarn: command not found
0
answers
0
votes
5
views
asked 7 days ago

Popular users

see all
1/18

Learn AWS faster by following popular topics

1/1