- 最新
- 最多得票
- 最多評論
The "ScriptMissing" error in AWS CodeDeploy typically indicates that CodeDeploy cannot find the specified script at the location specified in your appspec.yml file. Here are some steps and considerations to troubleshoot and resolve this issue:
Verify Script Location and Permissions
-
Double-check Script Location: Ensure that the stop_server.sh script is indeed located in the scripts directory of your Angular root directory. If the script is not present or is located elsewhere, CodeDeploy will fail to find it during deployment.
-
Confirm File Permissions: Check the permissions of the stop_server.sh script. The script should have executable permissions (chmod +x stop_server.sh) to ensure that it can be executed during the deployment process.
Debugging Steps
- Review CodeDeploy Logs: Check the CodeDeploy logs to get more specific information about why the script is not being found. You can access CodeDeploy logs through the AWS Management Console or via the AWS CLI.
bash
aws deploy get-deployment --deployment-id <deployment-id> --query "deploymentInfo.[status, diagnostics[0].message]"
Replace <deployment-id> with your actual deployment ID.
-
Agent Configuration: Sometimes, issues can arise if the CodeDeploy agent does not have the correct permissions or if there are issues with its configuration. Ensure that the agent is running and has the necessary permissions to access and execute scripts from the specified locations.
-
File Structure Consistency: If you've tried clearing out the deployment files and restarting the CodeDeploy agent without success, ensure that the directory structure and file paths in your deployment package (ZIP file or S3 bucket) match what is specified in your appspec.yml.
Example Fix Assuming your stop_server.sh script is correctly located in scripts/stop_server.sh relative to your deployment root, and has executable permissions, here's how your appspec.yml should be structured:
yaml
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/myapp
hooks:
BeforeInstall:
- location: scripts/remove_root_dir.sh
timeout: 900
runas: root
ApplicationStart:
- location: scripts/install_dependencies.sh
timeout: 300
runas: root
- location: scripts/start_server.sh
timeout: 300
runas: root
ApplicationStop:
- location: scripts/stop_server.sh
timeout: 300
runas: root
Ensure that:
stop_server.sh exists in the scripts directory relative to the root of your deployment. The script has executable permissions (chmod +x stop_server.sh). The path specified (scripts/stop_server.sh) matches the actual path where stop_server.sh is located in your deployment artifact. By carefully verifying these aspects, you should be able to resolve the "ScriptMissing" error and successfully deploy your application using AWS CodeDeploy. If issues persist, reviewing detailed logs and ensuring consistent configurations across your deployment environment can provide further insights.
相關內容
- 已提問 6 個月前
- 已提問 2 年前
- 已提問 3 年前

I'm facing a similar issue. Here's my
Appspec.yml:I clear out all references to previous deployments. I create a new deployment and run it. The error message I get is:
scripts/test-script.sh "BeforeInstall" Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/f533eddd-98eb-4276-9454-c657056ccd25/d-ZAJ4AH94G/deployment-archive/scripts/test-script.sh "BeforeInstall" View more.N.b.
test-script.shcontains onlyecho $1. It's a test-file that I'll update once I have this deployment pipeline working sucessfully.My question is: How do I get the EC2 to run the scripts from my project's root directory, and not this
/opt/codedeploy-agent/deployment-root/<deployment-id>directory?