跳至内容

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

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

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。