14
votes

On a Gatsby 2.17.6 project, when building:

Building production JavaScript and CSS bundles [====
] 1.940 s 1/6 17% run queries failed Building production JavaScript and CSS bundles - 75.519s

ERROR #98123 WEBPACK

Generating JavaScript bundles failed

postcss-svgo: TypeError: Cannot set property 'multipassCount' of undefined

not finished run queries - 77.639s npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build: node node_modules/gatsby/dist/bin/gatsby.js build` npm ERR! Exit status 1

These are some of my dependencies:

"dependencies": {
    "babel-plugin-styled-components": "^1.8.0",
    :
    "gatsby": "^2.0.19",
    "gatsby-plugin-favicon": "^3.1.4",
    "gatsby-plugin-google-fonts": "0.0.4",
    "gatsby-plugin-offline": "^2.0.5",
    "gatsby-plugin-react-helmet": "^3.0.0",
    "gatsby-plugin-styled-components": "^3.0.1",
    :
    "react": "^16.5.1",
    "react-dom": "^16.5.1",
    "react-helmet": "^5.2.0",
    "react-leaflet": "^2.1.1",
    "styled-components": "^4.1.1"
  }

I don't see any configurations about postcss on gatsby-config.js, I guess it's a default behaviour of Gatsby. npm ls postcss-svgo throw this:

[email protected] /<app>/source
└─┬ [email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └── [email protected] 

I wouldn't mind to disable postcss-svgo if that's a solution, but I don't know how.

4
I'm getting the same error, coming in through [email protected] or 3.0.1 as the dependency from my project, also on Node 8.interfect

4 Answers

9
votes
5
votes

"resolutions": { "svgo": "1.3.0" }

Add the above to your "package.json" and then rm -rf node_modules to remove "node_modules" and then reinstall "node_modules" again.

This will resolve issue. This issue is related to latest version of postcss-svgo.

0
votes

Version 1.3.2 of svgo has been released, and this bug is suposed to be fixed

So, it would be enough to remove your node_modules dir and package-lock.json file, and make a new npm install or yarn install

Anyway, thanks to other users suggesting to rollback svgo to 1.3.0

-1
votes

It works.

  • $ npm install -g svgo
  • remove node_modules and package-lock.json
  • $ npm install
  • build project