question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gatsby-plugin-sass error with postCssAssets

See original GitHub issue

Description

Upgraded from gatsby-plugin-sass ^2.3.22 to ^2.4.1 No indication from the documentation of any breaking change that I can see, but now when I try and run gatsby develop I get the following error message:

error Invalid plugin options for "gatsby-plugin-sass":

- "postCssPlugins[1]" must be of type object
- "postCssPlugins[2]" must be of type object

My config hasn’t changed.

const postcssAssets = require('postcss-assets');
const postcssNormalize = require('postcss-normalize');
const postcssPresetEnv = require('postcss-preset-env');
const sass = require('sass');

...

{
            resolve: 'gatsby-plugin-sass',
            options: {
                implementation: sass,
                postCssPlugins: [
                    postcssAssets({
                        loadPaths: ['/src/assets/images'],
                        relative: true
                    }),
                    postcssNormalize,
                    postcssPresetEnv
                ]
            }
        }

I tried changing both postcssNormalize and postcssPresetEnv to postcssNormalize() and postcssPresetEnv() but it didn’t change anything (and I don’t think I should need to do this anyway?)

Steps to reproduce

Clear steps describing how to reproduce the issue. Please please please link to a demo project if possible, this makes your issue much easier to diagnose (seriously).

How to Make a Minimal Reproduction: https://www.gatsbyjs.org/contributing/how-to-make-a-reproducible-test-case/

Expected result

Project runs

Actual result

success open and validate gatsby-configs - 0.514s
error Invalid plugin options for "gatsby-plugin-sass":

- "postCssPlugins[1]" must be of type object
- "postCssPlugins[2]" must be of type object
not finished load plugins - 0.147s
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! menu-web-beta@0.2.0 develop: `gatsby develop -H 0.0.0.0`
npm ERR! Exit status 1

Environment

gatsby info --clipboard

System: OS: macOS 10.15.7 CPU: (16) x64 Intel® Xeon® CPU E5-1680 v2 @ 3.00GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 15.0.1 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.8 - /usr/local/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 86.0.4240.111 Edge: 86.0.622.61 Firefox: 82.0.2 Safari: 14.0 npmPackages: gatsby: ^2.25.1 => 2.25.1 gatsby-cli: ^2.12.115 => 2.12.115 gatsby-plugin-manifest: ^2.5.1 => 2.5.1 gatsby-plugin-offline: ^3.3.1 => 3.3.1 gatsby-plugin-preload-fonts: ^1.2.29 => 1.2.29 gatsby-plugin-react-helmet: ^3.3.14 => 3.3.14 gatsby-plugin-robots-txt: ^1.5.3 => 1.5.3 gatsby-plugin-sass: ^2.4.1 => 2.4.1 gatsby-plugin-sharp: ^2.7.0 => 2.7.0 gatsby-plugin-sitemap: ^2.5.0 => 2.5.0 gatsby-source-filesystem: ^2.4.0 => 2.4.0 gatsby-source-graphql: ^2.7.6 => 2.7.6 gatsby-transformer-sharp: ^2.5.21 => 2.5.21

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
mxstbrcommented, Nov 4, 2020

Fix incoming! Thanks for the detailed report folks, sorry about the troubles 👍

6reactions
Kikobeatscommented, Nov 12, 2020

this is still an issue 😭

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gatsby Develop Failing using gatsby-plugin-sass
After installing the gatsby-plugin-sass module: When I try to run gatsby build, I get the following error: ERROR Unknown error from PostCSS ......
Read more >
gatsby-plugin-sass
gatsby -plugin-sass. Provides drop-in support for Sass/SCSS stylesheets. Install. npm install sass gatsby-plugin-sass. How to use. Include the plugin in your ...
Read more >
error: node sass version 7.0.1 is incompatible with ^4.0.0.
When adding the gatsby-plugin-sass to new project, I get the error in the terminal Generating development JavaScript bundle failed Node Sass version 5.0.0...
Read more >
Gatsby Changelog | 5.3.0
You might have run into an error like this while using Gatsby: ... For example, in gatsby-plugin-image you were able to use it...
Read more >
Advanced Features: Customizing PostCSS Config - Next.js
Extend the PostCSS config and plugins added by Next.js with your own. ... If you must use variables, consider using something like Sass...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found