I’m trying to use
{{ $styles := resources.Get "style/main.scss" | resources.ToCSS | resources.PostCSS }}
but when I build, I get this error:
INFO 2018/08/14 09:25:25 postcss: use config file /home/jbandlow/Programming/web/followinggradients/postcss.config.js
/usr/bin/env: 'node': No such file or directory
ERROR 2018/08/14 09:25:25 error: failed to transform resource: exit status 127
If I remove the final pipe, everything works, and so I believe that the error is occurring when this code is calling the postcss script:
$ cat node_modules/postcss-cli/bin/postcss
#!/usr/bin/env node
require('../')
I’ve installed post-css and autoprefixer with npm install -D
, and the following works as expected:
node_modules/postcss-cli/bin/postcss static/main.css --config postcss.config.js
On a lark, I even tried to run postcss from Go. With the following, go run mytest.go
works as expected:
// mytest.go
package main
import (
"fmt"
"log"
"os/exec"
)
func main() {
out, err := exec.Command("node_modules/postcss-cli/bin/postcss", "static/main.css").Output()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s", out)
}
My Hugo environment:
$ hugo env
Hugo Static Site Generator v0.46/extended linux/amd64 BuildDate: 2018-08-01T13:25:43Z
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.10.3"
and for whatever it’s worth, it was installed via snap
.
I can’t shake the feeling that I’m missing something really silly here, but if so, I just can’t see it. Does anyone have any ideas?