Been trying to sort this :arrow_up: error without ...
# seed
c
Been trying to sort this ⬆️ error without much luck. I’ve tried adding explicit ‘build_before’ commands in
seed.yml
and pinning the svelte-kit dependencies in
frontend/package.json
to specific versions w/o any success. I continue to hit a wall with Seed not able to build frontend due to missing dependency. Current error log and StaticSite construct code in thread – any insights on where else I might look to try and untangle this?
Copy code
⏳ Build v10 started...
Copy code
====================
⚡️ Init
====================
Copy code
INFO: Decrypting Seed secret environment variables...
0.03 s
Copy code
INFO: Build system information
Copy code
INFO: Build system environment
Copy code
INFO: Restoring source code cache...
1.05 s
Copy code
INFO: Checking for changes in the salesinsight-hubspot service using lerna...
0.10 s
Copy code
INFO: Restoring dependency cache...
3.00 s
Copy code
```
==================== 🛠 Compile ====================
Copy code
```$ cd /tmp/seed/source
INFO: before_compile hook not found. You can define it in your build spec.
INFO: Learn more about adding a build spec - seed.run/docs/adding-a-build-spec
INFO: Looking for package.json...
Copy code
$ yarn
154.89 s
Copy code
```
==================== 🧪 Unit Test ====================
Copy code
```INFO: Unit tests are disabled. You can enable them in the app settings.
INFO: Learn more about running tests - seed.run/docs/running-tests
Copy code
====================
📦 Build
====================
Copy code
$ 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 - seed.run/docs/adding-a-build-spec
Copy code
$ yarn sst build --stage pr4 --verbose
4.53 s
Copy code
SST: 0.43.2
CDK: 1.114.0
Using stage: pr4
Preparing your SST app
Transpiling source
Linting source
Synthesizing CDK
synth {
  output: '.build/cdk.out',
  app: 'node .build/run.js',
  roleArn: undefined,
  verbose: 2,
  noColor: true
}
CDK toolkit version: 1.114.0 (build 7e41b6b)
Command line arguments: {
  _: [ 'synth' ],
  'version-reporting': false,
  versionReporting: false,
  app: 'node .build/run.js',
  a: 'node .build/run.js',
  output: '.build/cdk.out',
  o: '.build/cdk.out',
  quiet: true,
  q: true,
  color: false,
  verbose: 1,
  v: 1,
  disableVersionCheck: 'true',
  lookups: true,
  'ignore-errors': false,
  ignoreErrors: false,
  json: false,
  j: false,
  debug: false,
  ec2creds: undefined,
  i: undefined,
  'path-metadata': true,
  pathMetadata: true,
  'asset-metadata': true,
  assetMetadata: true,
  'role-arn': undefined,
  r: undefined,
  roleArn: undefined,
  staging: true,
  'no-color': false,
  noColor: false,
  fail: false,
  validation: true,
  '$0': 'node_modules/aws-cdk/bin/cdk'
}
merged settings: {
  versionReporting: false,
  pathMetadata: true,
  output: '.build/cdk.out',
  app: 'node .build/run.js',
  context: {},
  debug: false,
  assetMetadata: true,
  toolkitBucket: {},
  staging: true,
  bundlingStacks: [ '*' ],
  lookups: true
}
Toolkit stack: CDKToolkit
Setting "CDK_DEFAULT_REGION" environment variable to us-east-1
Resolving default credentials
Looking up default account ID from STS
Default account ID: 635813714697
Setting "CDK_DEFAULT_ACCOUNT" environment variable to 635813714697
context: {
  'aws:cdk:enable-path-metadata': true,
  'aws:cdk:enable-asset-metadata': true,
  'aws:cdk:disable-version-reporting': true,
  'aws:cdk:bundling-stacks': [ '*' ]
}
outdir: .build/cdk.out
env: {
  CDK_DEFAULT_REGION: 'us-east-1',
  CDK_DEFAULT_ACCOUNT: '635813714697',
  CDK_CONTEXT_JSON: '{"aws:cdk:enable-path-metadata":true,"aws:cdk:enable-asset-metadata":true,"aws:cdk:disable-version-reporting":true,"aws:cdk:bundling-stacks":["*"]}',
  CDK_OUTDIR: '.build/cdk.out',
  CDK_CLI_ASM_VERSION: '12.0.0',
  CDK_CLI_VERSION: '1.114.0'
}
[dotenv][DEBUG] did not match key and value when parsing line 1: 
[dotenv][DEBUG] did not match key and value when parsing line 1: # These variables are only available in your SST code.
[dotenv][DEBUG] did not match key and value when parsing line 2: # To apply them to your Lambda functions, checkout this doc - <https://docs.serverless-stack.com/environment-variables#environment-variables-in-lambda-functions>
[dotenv][DEBUG] did not match key and value when parsing line 3: 
[dotenv][DEBUG] did not match key and value when parsing line 5: 
Building Lambda function src/services/service1/handler.main
Building Lambda function src/services/service2/handler.main
Building static site frontend
npm WARN lifecycle The node binary used for scripts is /tmp/xfs-797e4f0c/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> frontend@0.0.1 build /tmp/seed/source/frontend
> svelte-kit build
sh: 1: svelte-kit: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! frontend@0.0.1 build: `svelte-kit build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the frontend@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-09-25T17_11_06_415Z-debug.log
Error: There was a problem building the "Site" StaticSite.
    at StaticSite.buildApp (/tmp/seed/source/node_modules/@serverless-stack/resources/src/StaticSite.ts:328:15)
    at new StaticSite (/tmp/seed/source/node_modules/@serverless-stack/resources/src/StaticSite.ts:134:24)
    at new WebsiteStack (/tmp/seed/source/lib/WebsiteStack.js:7:18)
    at Object.main (/tmp/seed/source/lib/index.js:13:3)
    at Object.<anonymous> (/tmp/seed/source/.build/run.js:90:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
Error: Subprocess exited with error 1
    at ChildProcess.<anonymous> (/tmp/seed/source/node_modules/aws-cdk/lib/api/cxapp/exec.ts:122:23)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.EventEmitter.emit (domain.js:467:12)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
There was an error synthesizing your app.
ERROR: Error: Subprocess exited with error 1
Copy code
```
```
Copy code
Build v10 completed in 2m 45s. Used 0 build minutes.
Copy code
```
```
Copy code
====================
🗑 Cleanup
====================
Copy code
// lib/WebsiteStack.js

import * as sst from "@serverless-stack/resources";

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

    const site = new sst.StaticSite(this, "Site", {
      path: "frontend",
      buildOutput: "build",
      buildCommand: "npm run build",
      // pass in environment variables
      environment: {
        VITE_SVELTE_APP_REGION: scope.region,
        VITE_SVELTE_APP_SERVICE_01_URL: props.api1.url,
        VITE_SVELTE_APP_SERVICE_02_URL: props.api2.url,
      },
    });

    // Show the endpoint in the output
    this.addOutputs({
      WebsiteURL: site.url,
    });
  }
}