내용으로 건너뛰기

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년 전528회 조회

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

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠