node.js - postcss-svgo : TypeError: Cannot set property 'multipassCount' of undefined (Gatsby)

标签 node.js webpack redhat gatsby postcss

在 Gatsby 2.17.6 项目上,构建时:

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! gatsby-starter-default@1.0.0 build: node node_modules/gatsby/dist/bin/gatsby.js build` npm ERR! Exit status 1

这些是我的一些依赖项:

"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"
  }

我在 gatsby-config.js 上没有看到任何关于 postcss 的配置,我猜这是 Gatsby 的默认行为。 npm ls postcss-svgo 抛出这个:

gatsby-starter-default@1.0.0 /<app>/source
└─┬ gatsby@2.17.6
  └─┬ optimize-css-assets-webpack-plugin@5.0.3
    └─┬ cssnano@4.1.10
      └─┬ cssnano-preset-default@4.0.7
        └── postcss-svgo@4.0.2 

如果这是一个解决方案,我不介意禁用 postcss-svgo,但我不知道如何。

最佳答案

我的项目已解决,使用npm install svgo@1.3.0 -E,详细参见:https://github.com/svg/svgo/issues/1174

关于node.js - postcss-svgo : TypeError: Cannot set property 'multipassCount' of undefined (Gatsby),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58616161/

相关文章:

javascript - webpack输出文件名配置错误

linux - 如何永久添加环境变量?

linux - 尝试在 redhat 机器中构建应用程序并从链接器获取 undefined reference 错误

javascript - Express 中间件被多次调用

javascript - 有没有办法检查JS中的字符串是否是单个表情符号?

javascript - Meal.nutrition 的类型必须是 Output Type 但得到 : undefined

node.js - 将 Benchmarkjs 与 Webpack 和 Babel 结合使用

javascript - 重写 Webpack 代理 URL

javascript - 如何将 CSS 文件与 HTML 文件一起发送?

linux - 在 red hat 中将目录放入垃圾箱