- Newest
- Most votes
- Most comments
I found a somewhat amusing workaround that outputs a run.sh file during the build, then executes that in the run phase.
version: 1.0
runtime: nodejs22
build:
commands:
pre-build:
- echo -e '#!/bin/sh\\ncd showcase\\nnpm run serve' > ./run.sh
- chmod +x ./run.sh
build:
- npm install && npm run build
- cd showcase && npm install && npm run build
run:
command: ./run.sh
network:
port: 8080
This is, of course, bonkers. But I've tried all the obvious alternatives, and they all result in some kind of parsing/shell issue.
answered a year ago
Hello.
How about creating a shell script file with the build and execution commands as shown below?
version: 1.0
runtime: nodejs22
build:
commands:
build:
- build.sh
run:
command: entrypoint.sh
network:
port: 8080
build.sh
#!/usr/bin/env bash
npm install
npm run build
cd showcase
npm install
npm run build
entrypoint.sh
#!/usr/bin/env bash
cd showcase
npm run serve
The error you're encountering with AWS App Runner is related to the run command in your apprunner.yaml file. The issue is with how the cd command is being interpreted.
In your configuration, you have:
run:
command: "cd showcase && npm run serve"
The error message /usr/bin/cd: line 2: cd: too many arguments suggests that the cd command is not being processed correctly. This is likely because App Runner is trying to execute the entire string as a single command rather than as separate commands.
To fix this issue, try modifying your apprunner.yaml file to use one of these approaches:
Option 1: Use the working directory setting:
run:
command: "npm run serve"
working-directory: "showcase"
Option 2: Use a shell to execute the commands:
run:
command: "sh -c 'cd showcase && npm run serve'"
Option 3: Use the full path to the directory:
run:
command: "cd /app/showcase && npm run serve"
The apprunner.yaml configuration file is used to instruct App Runner on how to build and start your service, and sometimes the way commands are interpreted can cause issues like this. Making one of these changes should resolve the deployment failure.
Sources
Setting App Runner service options using a configuration file - AWS App Runner
Troubleshooting - AWS App Runner
answered a year ago
Relevant content
asked 5 years ago
- AWS OFFICIALUpdated 4 years ago

There is no such thing as a "working-directory" in the "run" section. https://docs.aws.amazon.com/apprunner/latest/dg/config-file-ref.html#config-file-ref.run
None of these suggestions helped.
Option 1: Hallucination.
working-directoryis not supported underrun:Failed to build your application source code. Reason: Failed to validate configuration file. Check the file's content. Details: fail to read bullet config file: Unrecognized field "working-directory"Option 2: invalid syntax leads to:
showcase: -c: line 1: unexpected EOF while looking for matching''. So I tried with escaped double quotes but that leads toshowcase: -c: line 1: unexpected EOF while looking for matching"'Option 3: doesn't make any sense. If running
cdin thecommandis the problem then this also clearly won't work