# PostCSS - "Error: cannot find module 'tailwindcss'"

**URL:** <https://discourse.gohugo.io/t/postcss-error-cannot-find-module-tailwindcss/34581>\
**Category:** support\
**Created:** [September 4, 2021, 5:33pm UTC](https://discourse.gohugo.io/t/postcss-error-cannot-find-module-tailwindcss/34581 "2021-09-04T17:33:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![omp](https://avatars.discourse-cdn.com/v4/letter/o/8edcca/32.png) [@omp](https://discourse.gohugo.io/u/omp)\
**Post date:** [September 4, 2021, 5:33pm UTC](https://discourse.gohugo.io/t/postcss-error-cannot-find-module-tailwindcss/34581/1 "2021-09-04T17:33:28Z")

</div>

Hi,

I started from a new site:

```auto
$ hugo new site foo
$ cd foo
$ hugo mod init foo

```

added this to `config.toml`:

```auto
[[module.imports]]
path="github.com/bep/hugo-starter-tailwind-basic/v2"

```

ran npm commands:

```auto
$ hugo mod get
$ hugo mod npm pack
$ npm install
$ npm install -g postcss postcss-cli autoprefixer

```

Running `hugo server` gives an error:

```auto
Error: Error building site: POSTCSS: failed to transform "css/styles.css" (text/css): Error: Cannot find module 'tailwindcss'

```

Am I using the theme correctly? I’m using hugo-extended v0.88.1.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 5, 2021, 4:40am UTC](https://discourse.gohugo.io/t/postcss-error-cannot-find-module-tailwindcss/34581/2 "2021-09-05T04:40:27Z")

</div>

I think you missed a step (npm install). Start over.

```bash
hugo new site bar
cd bar
hugo mod init bar

```

Add this to config.toml

```nohighlight
[build]
writeStats = true

[[module.imports]]
path="github.com/bep/hugo-starter-tailwind-basic/v2"

```

Then

```auto
hugo mod npm pack
npm install
hugo server

```

---

<div class="post-metadata">

**Author:** ![omp](https://avatars.discourse-cdn.com/v4/letter/o/8edcca/32.png) [@omp](https://discourse.gohugo.io/u/omp)\
**Post date:** [September 5, 2021, 12:48pm UTC](https://discourse.gohugo.io/t/postcss-error-cannot-find-module-tailwindcss/34581/3 "2021-09-05T12:48:55Z")

</div>

Thanks for the suggestion, but I definitely ran `npm install` right after `hugo mod npm pack` and I have a populated `foo/node_modules` directory that includes `tailwindcss`.

Here’s my `hugo env`

```auto
hugo v0.88.1-5BC54738+extended windows/amd64 BuildDate=2021-09-04T09:39:19Z VendorInfo=gohugoio
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.16.7"

```

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [September 6, 2021, 1:22am UTC](https://discourse.gohugo.io/t/postcss-error-cannot-find-module-tailwindcss/34581/4 "2021-09-06T01:22:53Z")

</div>

I am unable to reproduce the problem under Linux or Windows. Here’s my Windows environment.

```nohighlight
hugo v0.88.1-5BC54738 windows/amd64 BuildDate=2021-09-04T09:39:19Z VendorInfo=gohugoio
GOOS="windows"      
GOARCH="amd64"      
GOVERSION="go1.16.7"

```

You might try deleting the node\_modules directory, then run `npm install` again.

And you do **not** need to run `npm install -g postcss postcss-cli autoprefixer`. These are locally installed when you run `npm install`.

---

<div class="post-metadata">

**Author:** ![omp](https://avatars.discourse-cdn.com/v4/letter/o/8edcca/32.png) [@omp](https://discourse.gohugo.io/u/omp)\
**Post date:** [September 6, 2021, 2:34am UTC](https://discourse.gohugo.io/t/postcss-error-cannot-find-module-tailwindcss/34581/5 "2021-09-06T02:34:33Z")

</div>

Thank you for checking it out. The problem turned out to be the NODE\_PATH environment variable was set to a global `yarn` directory - which of course did not have `tailwindcss` installed…

Thanks for your help and support in the forums and github, etc - this is a great community. 🙂
