The action fails if you are using npm as your package manager.
Ready to build your Gatsby site!
Building with: npm run gatsby build
npm run gatsby build
npm ERR! missing script: gatsby
This is because npm run gatsby build causes npm to look for a script called gatsby. This is not a problem for yarn, since yarn run gatsby build actually runs gatsby build.
Temporary solution for anyone using npm
Create a script in your package.json called gatsby:
"gatsby": "gatsby build"
Proposed solution
Instead of trying to run gatsby build, run the build script that Gatsby automatically generates in package.json.
console.log(`Building with: ${pkgManager} run build ${gatsbyArgs}`)
await exec.exec(`${pkgManager} run build`, [gatsbyArgs])
The action fails if you are using
npm
as your package manager.This is because
npm run gatsby build
causesnpm
to look for a script calledgatsby
. This is not a problem foryarn
, sinceyarn run gatsby build
actually runsgatsby build
.Temporary solution for anyone using npm
Create a script in your
package.json
calledgatsby
:Proposed solution
Instead of trying to run
gatsby build
, run the build script that Gatsby automatically generates inpackage.json
.