jekyll-postcss
jekyll-postcss copied to clipboard
Netlify issue: missing node_modules packages. (resolved, but FYI)
In your README you mention that you must install postcss with npm or yarn. I'd done this with yarn add <package-name> -D
, which places things in the devDependencies
hash key in package.json
. This is fine. Typically running bundle exec jekyll build
locally will result in everything working just fine. Great!
Here's the hiccup: In many jekyll + postcss blog posts (eg: here) there are instructions that instruct people to set the following ENV variables:
When building for production, always set
JEKYLL_ENV=production
andNODE_ENV=production
on the command line. When these variables are set to production, unused Tailwind styles are purged and the output is processed with cssnano.
This where the problem comes in. When deploying and building on Netlify NODE_ENV=production
+ yarn add ______ -D
seems to result in an empty ./node_modules
directory.
When I moved everything from devDependencies
to dependencies
in packages.json
then everything started working.
I don't know if this is a Netlify thing or not but, in the off-chance anyone shows up here with missing node_modules
packages, this might be the answer.
TLDR: Do not install your node dependencies via yarn add .... -D
or npm install <package-name> --save-dev