【问题标题】:How to install plugins in gatsby cloud?如何在 gatsby 云中安装插件?
【发布时间】:2021-09-02 15:49:14
【问题描述】:

我正在关注 gatsby 教程: https://www.gatsbyjs.com/docs/tutorial/

它工作得很好,除了插件在我的本地开发环境中工作正常,而不是在 gatbsy 云中。我必须做一些特别的事情才能在 gatsby 云中安装插件吗?我在文档或谷歌搜索中找不到任何东西,但也许我遗漏了一些明显的东西?

我的构建错误是:

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

是的,我确实通过 NPM 在本地进行了安装,并且它在我的本地计算机上的开发模式下运行良好。

我的 gatsby-config.js 文件是:

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",
    ],
};

【问题讨论】:

    标签: gatsby gatsby-plugin gatsby-cloud


    【解决方案1】:

    想通了。通过弄清楚我的意思是支持给我发电子邮件并告诉我。我试图变得聪明,只检查我更改的文件。原来我忘了添加 package.json 和 package-lock.json,所以 NPM 没有看到新插件。舒夫普斯!

    感谢盖茨比的支持!

    【讨论】:

      【解决方案2】:

      如果你已经推送了你的 package.json 和 package-lock.json 文件,你可以试试这 2 件事:

      1- 在没有缓存的情况下在 Gatsby Cloud 上触发构建; “清除缓存并构建”。 (这对我有用。)

      2- 删除你的 node_modules 文件夹和 package-lock.json,重新运行 npm i 并推送新的 package-lock.json。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-08-29
        • 1970-01-01
        • 2017-12-29
        • 1970-01-01
        • 1970-01-01
        • 2020-09-04
        • 2021-03-06
        • 2023-04-11
        相关资源
        最近更新 更多