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.

'Unknown Word' error in CSS Minimizer and Postcss Modules causing 'Build' failure even though 'Develop' Works.

See original GitHub issue

Preliminary Checks

Description

My Gatsby.js site runs without error when I use ‘gatsby develop’ but the build always fails returning the following error when I ‘gatsby build’:

` Generating JavaScript bundles failed

styles.1a4684d19cee467a516a.css from Css Minimizer C:\xampp\htdocs\gatsby-troubleshoot-positiveo\styles.1a4684d19cee467a516a.css:756:5 : Unknown word [styles.1a4684d19cee467a516a.css:756,5] at Input.error (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\post css\lib\input.js:123:16) at Parser.unknownWord (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modul es\postcss\lib\parser.js:518:22) at Parser.other (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\pos tcss\lib\parser.js:149:12) at Parser.parse (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\pos tcss\lib\parser.js:59:16) at parse (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\postcss\li b\parse.js:11:12) at new LazyResult (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\p ostcss\lib\lazy-result.js:133:16) at Processor.process (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_module s\postcss\lib\processor.js:36:12) at cssnanoMinify (eval at transform (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\gatsby\node_modules\css -minimizer-webpack-plugin\dist\minify.js:34:28), <anonymous>:51:61) at minify (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\gatsby\no de_modules\css-minimizer-webpack-plugin\dist\minify.js:15:32) at Object.transform (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules \gatsby\node_modules\css-minimizer-webpack-plugin\dist\minify.js:35:24)

File: styles.1a4684d19cee467a516a.css ` Link to reproduced github:

https://github.com/Dahbu7/gatsby-issue-1

I have uninstalled postcss and postcss-loader and reinstalled them as dev dependencies - that didn’t work I have uninstalled css-minimizer-webpack-plugin and reinstalled it as dev dependency - that didn’t work either.

PLEASE NOTE: After I uninstalled just postcss I ran build again so it could use the postcss package that is in the node_modules/gatsby folder as in, node_modules/gatsby/node_modules/postcss and that didn’t work either.

My Node version is: v14.15.0 My dev-dependency installed webpack version is: Everything else can be found in the github light reproduction repo:

https://github.com/Dahbu7/gatsby-issue-1

I tried hosting it on gatsby cloud and the deploy build failed there too for the exact same reason. I even did the NODE_VERSION = 16 thing as an environment variable and that didn’t work. Please try it again though. Maybe I did it wrong.

I have done several react projects but this is my first time converting over to Gatsby. Any help woud be greatly appreciated.

Reproduction Link

https://github.com/Dahbu7/gatsby-issue-1

Steps to Reproduce

  1. Go to the repo I posted: https://github.com/Dahbu7/gatsby-issue-1
  2. You can run gatsby build on your system or any platform of your choice.
  3. Node Version is v14.15.0 …

Expected Result

Javascript bundles of node modules should build without error when ‘gatsby build’ is ran. It builds properly with ‘gatsby develop’.

Actual Result

failed Building production JavaScript and CSS bundles - 116.946s

ERROR #98123 WEBPACK

Generating JavaScript bundles failed

styles.1a4684d19cee467a516a.css from Css Minimizer C:\xampp\htdocs\gatsby-troubleshoot-positiveo\styles.1a4684d19cee467a516a.css:756:5 : Unknown word [styles.1a4684d19cee467a516a.css:756,5] at Input.error (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\post css\lib\input.js:123:16) at Parser.unknownWord (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modul es\postcss\lib\parser.js:518:22) at Parser.other (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\pos tcss\lib\parser.js:149:12) at Parser.parse (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\pos tcss\lib\parser.js:59:16) at parse (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\postcss\li b\parse.js:11:12) at new LazyResult (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\p ostcss\lib\lazy-result.js:133:16) at Processor.process (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_module s\postcss\lib\processor.js:36:12) at cssnanoMinify (eval at transform (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\gatsby\node_modules\css -minimizer-webpack-plugin\dist\minify.js:34:28), <anonymous>:51:61) at minify (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules\gatsby\no de_modules\css-minimizer-webpack-plugin\dist\minify.js:15:32) at Object.transform (C:\xampp\htdocs\gatsby-troubleshoot-positiveo\node_modules \gatsby\node_modules\css-minimizer-webpack-plugin\dist\minify.js:35:24)

File: styles.1a4684d19cee467a516a.css

Environment

System:
    OS: Windows 10 10.0.19042
    CPU: (4) x64 Intel(R) Core(TM) i5-3340M CPU @ 2.70GHz
  Binaries:
    Node: 14.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 94.0.4606.71
    Edge: Spartan (44.19041.1023.0), Chromium (94.0.992.38)
  npmPackages:
    gatsby: ^3.13.1 => 3.14.2
    gatsby-plugin-image: ^1.14.1 => 1.14.1
    gatsby-plugin-manifest: ^3.14.0 => 3.14.0
    gatsby-plugin-postcss: ^4.14.0 => 4.14.0
    gatsby-plugin-preconnect: ^1.2.1 => 1.2.1
    gatsby-plugin-preload-fonts: ^2.14.0 => 2.14.0
    gatsby-plugin-react-helmet: ^4.14.0 => 4.14.0
    gatsby-plugin-react-svg: ^3.0.1 => 3.0.1
    gatsby-plugin-sharp: ^3.14.1 => 3.14.1
    gatsby-plugin-sitemap: ^4.10.0 => 4.10.0
    gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
    gatsby-source-filesystem: ^3.14.0 => 3.14.0
    gatsby-theme-material-ui: ^2.0.1 => 2.0.1
    gatsby-transformer-sharp: ^3.14.0 => 3.14.0
  npmGlobalPackages:
    gatsby-cli: 3.14.0

Config Flags

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
vic08commented, Jun 14, 2022

I’ve had a problem with dynamic string in the tailwind classNames when using the tailwind postcss plugin. Tailwind plugin takes plain strings from from classes and generates the css for it, so if you have "max-w-[${MAX_CONST}]" as a className - it will generate a broken css.

2reactions
lewismwakicommented, Nov 5, 2021

The issue I was having was due to including CSS files for slick carousel into the scss, I changed to the scss includes instead and things started working.

I managed to fix this error by completely removing the all import lines for slick-carousel.css on all the files that had it; then adding the CDN link directly to <Helmet/>

the links https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gatsby Build failed because of "Unknown Word' Error from ...
I tried hosting it on gatsby cloud and the deploy build failed there too for the exact same reason.
Read more >
postcss-loader | webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
postcss/postcss - Gitter
Hi all I'm getting this error while using postcss-loader. ERROR in ./node_modules/ag-grid-community/dist/styles/ag-theme-fresh.css Module build failed (from ...
Read more >
wordpress/scripts V19.X creating issues with style-loader rule ...
src/editor.css) Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): SyntaxError (2:7) /assets/new-blocks/src/editor.css Unknown word 1 ...
Read more >
How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
The code should still work, but you may want to look for a more up-to-date tutorial. ... Step 0: Create a project with...
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