I think I may have found a bug in how SST runs Sta...
# sst
d
I think I may have found a bug in how SST runs StaticSite build commands. In Yarn v1 this worked perfectly…. however, in Yarn v2-3 we’re now getting…
sh: gatsby: command not found
locally if I run
yarn build
(which is the build command we are telling sst to run) then everything works fine. Perhaps this has something to do with how Yarn v2 now handles exposing these depenceny’s bin now? Sound like they are adding the bins to the PATH which I’m guessing maybe SST isn’t making available to the build commands?
Pretty stumped on this one. I wrote this tiny script to try and replicate sst…
Copy code
const execSync = require("child_process").execSync

execSync('yarn build', {
  cwd: 'frontend-idx',
  stdio: "inherit",
  env: {
    ...process.env,
  },
});
and then I added
"dvb": "node test.js"
to the root package.json and ran
yarn dvb
Everything works just fine and installs. However, running
yarn deploy
in the root which runs sst deploy is now broken since adding Yarn v3 (node-modules linker not pnp)
@thdxr I ended up getting this to work by adding
gatsby-cli
to the root of the repo (instead of where it normally is next to the project in
frontend/
Odd that my test script doesn’t need this… but SST does. Very much not ideal though having to dupe all things into the parent package.json IF the plan is to have SST execute them.
Added Yarn 2 issue… but also feels like something that SST would want to work…https://github.com/yarnpkg/berry/issues/2416#issuecomment-967353330
sigh…. rolling back to v1. Can’t find a fix for this worth doing.
f
Hey @Dan Van Brunt, lemme give it a try on my end. Should I try yarn v2 or v3?
d
I was using v3
with node-modules linker
eg. NOT pnp
f
Do i set that in package.json? Can u show me a snippet?
d
yes
let me get for you
that goes in the repo root
packageManager needs to go into each of the workspaces and the root package json’s
then just run
npm install -g yarn
then in the project root run
yarn set version berry
all the tiny detains are in their migration notes.
FYI, all of these instructions are for the “consuming” project… not for sst’s repo
brb… making dinner for fam
f
Just gave it a try, this worked for me https://github.com/fwang/sst-gastby
I think i’m using yarn v3
d
Thanks @Frank let me try a stripped down version again