HUGO

Best setup for using Hugo Pipes with PostCSS and npm on a Mac?

I am stoked about Hugo Pipes, as it’s a chance for me to create my own Modular CSS workflow. Using Pipes and the globbing functionality of PostCSS, I should be able to concatenate and process discrete CSS text files eg from /src/03-objects/**/**/*.css

I’ve managed to get Pipes working, which is brilliant. But as soon as I invoke PostCSS, it opens a can of npm worms, all due to my local setup (works fine when I deploy to Netlify).

I’m in the process of clearing out my Node/npm installation on my old Mac running 10.13, but before I reinstall everything, I was wondering if anyone had any advice on installing Node/npm on a Mac so that it works with Hugo and PostCSS? eg should I install from binaries, should I use brew etc?

FWIW, this is the local Node error I get:

Error: Error building site: POSTCSS: failed to transform "css/main.css" (text/css): /Users/fgw/.nvm/versions/node/v8.9.1/lib/node_modules/postcss-cli/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
      } catch {
              ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:599:28)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/fgw/.nvm/versions/node/v8.9.1/lib/node_modules/postcss-cli/node_modules/fs-extra/lib/mkdirs/index.js:3:44)

And this is the very barebones Hugo site, called Godular (that’s short for Hugo Modular CSS, not an indication of it’s importance in the universe)

thanks, Jake

I think you probably need to update node (or npm or both). I was able to build your site without problem.

I think you have two main approaches: Install from brew (and keep it up to date) or use a docker image.

Personally I would recommend just installing from brew (node and npm and hugo), that’s probably the easiest.

2 Likes

Yes, I think @olikami is right (I have seen the same error).

1 Like

That’s great, thank you. I’ll press ahead with brew :grin:

I removed my old installation of Node, using these instructions, then reinstalled it with brew. Works fine now :slightly_smiling_face: Thank you!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.