【问题标题】:When I add gatsby-plugin-sass in gatsby-confis.js file当我在 gatsby-config.js 文件中添加 gatsby-plugin-sass
【发布时间】:2023-03-09 21:19:01
【问题描述】:
plugins: [
    `gatsby-plugin-react-helmet`,
    `gatsby-plugin-sass`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    },
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],

已经添加了插件但还是报错

模块构建失败(来自 ./node_modules/sass-loader/lib/loader.js):
错误:找不到模块“node-sass”

【问题讨论】:

    标签: reactjs gatsby


    【解决方案1】:

    Nose Sass 不包含在插件中,所以也尝试运行:

    npm install -S node-sass
    

    每个人:https://www.gatsbyjs.org/packages/gatsby-plugin-sass/#install

    对于大多数更改,您可以轻松升级或更改 Node Sass 的版本,而无需等待 Gatsby 插件维护者的更改。

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-18
      • 2019-11-11
      • 1970-01-01
      • 2020-08-27
      • 2021-07-17
      • 1970-01-01
      • 2021-01-24
      • 2022-01-11
      相关资源
      最近更新 更多