Command not found: sst | There was an error synthesizing your app

I am trying to provision aws ECS using aws cdk with sst in seed. And I got this issue saying command not found: sst

The logs says this:

$ cd /tmp/seed/source
INFO: before_build hook not found. You can define it in your build spec.
INFO: Learn more about adding a build spec -

$ cd /tmp/seed/source/backend/apollo-sst-test

$ npx sst build --stage devops --region ap-southeast-2 --verbose

npx: installed 1 in 1.171s
command not found: sst

ERROR: There was an error synthesizing your app.
INFO: Build completed in 2m 49s. Used 0 build minutes.

Mystack.js code is

import * as sst from "@serverless-stack/resources";
import * as ec2 from "@aws-cdk/aws-ec2";
import * as ecs from "@aws-cdk/aws-ecs";
import * as ecs_patterns from "@aws-cdk/aws-ecs-patterns";
import * as ecr from "@aws-cdk/aws-ecr";
import { DockerImageAsset } from '@aws-cdk/aws-ecr-assets';
import path from "path";
import process from  "process";

export default class MyStack extends sst.Stack {
  constructor(scope, id, props) {
    super(scope, id, props);

    // Define your stack
    const vpc = new ec2.Vpc(this, "myvpc", {
      maxAzs: 2 // Default is all AZs in region

    const cluster = new ecs.Cluster(this, "mycluster", {
      vpc: vpc

    //#endregionconst repo = new ecs.RepositoryImage("apollo-server");
    // const asset = new DockerImageAsset(this, 'MyBuildImage', {
    //   directory: path.join(__dirname, '../../apollo')
    // });
    const repo = ecr.Repository.fromRepositoryName(this, "apollo-server-2", "apollo-server-2");
    // Create a load-balanced Fargate service and make it public
    const loadBalancedFargateService = new ecs_patterns.ApplicationLoadBalancedFargateService(this, "myfargate-alb", {
      cluster: cluster, // Required
      cpu: 256, // Default is 256
      desiredCount: 1, // Default is 
      taskImageOptions: { image: ecs.ContainerImage.fromEcrRepository(repo)},
      memoryLimitMiB: 512, // Default is 512
      publicLoadBalancer: true,// Default is false
      environment: {
        stage: process.env.stage,
        cognitoConfig: `https://build-config-bucket-${process.env.stage}`,
	      databaseConfig: `https://build-config-bucket-${process.env.stage}`,
	      erwteConfig: `https://build-config-bucket-${process.env.stage}`

      path: "/.well-known/apollo/server-health",


Hmm that seems weird. Can you send us an email to with a link to this build ?

Hi I am having the same issue, the same code base is working in the original repo but after copying it to another repo it started giving the below error in new repo

npm ERR! errno 1
npm ERR! create-react-app@5.0.0 build: react-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the create-react-app@5.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-04-27T10_56_18_605Z-debug.log

Error: There was a problem building the “main-reactsite” StaticSite.

at ReactStaticSite.buildApp (/home/runner/work/app-folder/app-folder/node_modules/@serverless-stack/resources/src/StaticSite.ts:203:15)
at new StaticSite (/home/runner/work/app-folder/app-folder/node_modules/@serverless-stack/resources/src/StaticSite.ts:95:24)
at new ReactStaticSite (/home/runner/work/app-folder/app-folder/node_modules/@serverless-stack/resources/src/ReactStaticSite.ts:43:5)
at new MainStack (/home/runner/work/app-folder/app-folder/stacks/MainStack.js:151:18)
at Object.main (/home/runner/work/app-folder/app-folder/stacks/index.js:12:21)
at Object. (/home/runner/work/app-folder/app-folder/.build/run.js:94:16)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)

There was an error synthesizing your app.
Error: Process completed with exit code 1.