跳至內容

Getting file existing error mesage on codedeploy Install event

0

I am getting this error message during Install event in codedeploy: The deployment failed because a specified file already exists at this location: /var/www/api/app-name/.prettierrc

Here are my yaml and sh scripts

after_install.sh

#!/bin/bash

echo "Executing after_install.sh script..."

Navigate to app folder

cd /var/www/api/app-name

Ensure the latest code is checked out and dependencies are installed

git checkout origin/main git pull origin main npm install npm run build

before_install.sh

#!/bin/bash

Install node.js and PM2 globally

sudo apt-get update sudo apt-get install nodejs sudo apt-get install npm -y sudo npm install pm2 -g

===================== start_server.sh

echo "Executing start_server.sh script..."

pm2 restart 0 --name "api-sound" pm2 save

========================

appspec.yaml

version: 0.0

os: linux

files:

  • source: / destination: /var/www/api/app-name overwrite: true

hooks: BeforeInstall: - location: scripts/before_install.sh timeout: 300 runas: root

AfterInstall: - location: scripts/after_install.sh timeout: 300 runas: root

ApplicationStart: - location: scripts/start_server.sh timeout: 300 runas: root

any idea why i am encounterinf this during codedeploy?

Enter image description here

已提問 2 年前檢視次數 557 次

1 個回答
0

Hello.

Try adding "file_exists_behavior: OVERWRITE" to appspec.yml.
This will overwrite any duplicate files.
https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-files.html

專家

已回答 2 年前

專家

已審閱 2 年前

  • will try thank you so much

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。