1

I'm following the gatsby tutorial here: https://www.gatsbyjs.com/docs/tutorial/

And it works great, except the plugins work fine in my local dev environment and not in the gatbsy cloud. Do I have to do something special to install plugins in gatsby cloud? I couldn't find anything in the docs or by googling, but maybe I'm missing something obvious?

My build error is:

Restoring previous build cache and dependencies
2.25s
Install project dependencies
36.76s
Pulling latest commits from repository
1.11s
There was a problem loading plugin "gatsby-plugin-image". Perhaps you need to install its package?
Use --verbose to see actual error.

For more details see https://gatsby.dev/issue-how-to

open and validate gatsby-configs, load plugins
0.02s

And Yes I did install via NPM locally and it works fine in dev mode on my local machine.

My gatsby-config.js file is:

module.exports = {
  siteMetadata: {
    siteUrl: "https://www.yourdomain.tld",
    title: "Banana Rama",
  },
  plugins: [
    "gatsby-plugin-gatsby-cloud",
    "gatsby-plugin-image",
    "gatsby-plugin-sharp",
     {
      resolve: "gatsby-source-filesystem",
      options: {
        name: `blog`,
        path: `${__dirname}/blog`,
      }
    },
     "gatsby-plugin-mdx",
     "gatsby-transformer-sharp",
    ],
};
Félix Paradis
  • 5,165
  • 6
  • 40
  • 49
Gretski
  • 461
  • 4
  • 7

2 Answers2

0

Figured it out. And by figured it out I mean support emailed me back and told me. I was trying to be smart and only check into git the files I changed. Turns out I forgot to add package.json and package-lock.json, so NPM didn't see the new plugins. Schwups!

Thanks Gatsby support!

Gretski
  • 461
  • 4
  • 7
0

If you already pushed your package.json and package-lock.json files, you may try these 2 things:

1- Trigger a build on Gatsby Cloud without the cache; "Clear cache and build". (This worked for me.) enter image description here

2- Delete your node_modules folder and package-lock.json, re-run npm i and push the new package-lock.json.

Félix Paradis
  • 5,165
  • 6
  • 40
  • 49