After following the docs, my new Gatsby project build fails as the Gatsby command is not installed. I’ve marked the project as a Gatsby project in the build settings for Pages. is there anything else I have to do?
|10:12:19.440||
|---|---|
|10:12:19.440|found 0 vulnerabilities|
|10:12:19.473|Executing user command: gatsby build|
|10:12:19.480|/bin/sh: 1: gatsby: not found|
|10:12:19.482|Failed: Error while executing user command. Exited with error code: 127|
|10:12:19.491|Failed: build command exited with code: 1|
|10:12:20.335|Failed: error occurred while running build command|
in fact, when you select Gatsby in the framework dropdown, it pre-fills Gatsby build as the build command.
I wonder if the issue is that cloudflare is not detecting Gatsby (even though it’s in the package.json). If you look at a build log, it has Detected the following tools from environment: [email protected], [email protected]
ok, that worked. Can you explain why though. If Gatsby is not installed, how does npm run build work as it ends up calling the same Gatsby build as I typed from the command line.
gatsby is installed, but in node_modules/.bin. npm is smart and will look into this folder for what to run.
Pages Build Image v1 did some hackery magic adding node_modules/.bin to your PATH so you could just run gatsby directly, but this was non-standard, so is no longer done in Pages Build Image v2.
thanks. I’ve left feedback on the Gatsby page on the Pages docs with the details so hopefully they update their docs. Ideally they also update the default build command in the build settings as well. Anyone using Gatsby will run into this.