Build error on Ghost Docs

Note: This is an issue with the Ghost Docs project, not the Ghost itself.

When I try to create production build by the procedure in the Contributing page, the following error occurs in “gatsby build”.

error We encountered an error while trying to load your site's gatsby-config. Please fix the error and try again.

Error: GHOST_API_URL and GHOST_API_KEY are required to build. Check the CONTRI  BUTING guide.

I’ve already done the step #4 (Copy .env.example to .env.development) and could successfully run local build. (“gatsby develop”)

Could someone tell me how to solve this issue? Thanks.

@felipe a production build would use .env.production

Thanks @Kevin, that solved the error on gatsby build.
However, on gatsby serve, the same error as above occurs.

yarn serve succeeds without any issue, so should I stick to yarn serve instead for the time being?

Yes, stick to the yarn commands, they’re set up to work with this particular project.

1 Like

I followed the few instructions without success

  1. git clone this repo & cd into it as usual
  2. npm install --global gatsby-cli to install Gatsby
  3. yarn to install top-level dependencies.
  4. Copy .env.example to .env.development

gatsby develop:

⠁ Install service worker plugin
success open and validate gatsby-configs — 1.228 s
error Unable to find plugin "gatsby-plugin-sharp". Perhaps you need to install its package?


  Error: Unable to find plugin "gatsby-plugin-sharp". Perhaps you need to install its package?
  
  - load.js:102 resolvePlugin
    [docs]/[gatsby]/dist/bootstrap/load-plugins/load.js:102:11 
[....]

I’m trying to install gatsby-plugin-sharp but without success, keep giving me the same error.

sudo npm install --save gatsby-plugin-sharp

[sudo] password di ******: 

> sharp@0.21.0 install /home/******/Documenti/docs/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.0/libvips-8.7.0-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, open '/home/******/Documenti/docs/node_modules/sharp/21389-libvips-8.7.0-linux-x64.tar.gz'
ERR! sharp Please see http://sharp.pixelplumbing.com/page/install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/******/Documenti/docs/node_modules/sharp/build'
gyp ERR! System Linux 4.18.0-12-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/******/Documenti/docs/node_modules/sharp
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@3.0.0-next.66cc7a90 requires a peer of eslint@^4.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.21.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.21.0 install 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/******/.npm/_logs/2018-12-07T15_05_36_244Z-debug.log

gatsby build:

error We encountered an error while trying to load your site's gatsby-config. Please fix the error and try again.


  Error: GHOST_API_URL and GHOST_API_KEY are required to build. Check the CONTRIBUTING guide.
  
  - gatsby-config.js:16 Object.<anonymous>
    /home/******/Documenti/docs/gatsby-config.js:16:11
[....]

yarn serve:

00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'serve'

any suggestions?

Thank you

Hello,
If someone is interested i have resolved by installing npm packages with --unsafe-perm

npm install --unsafe-perm

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.