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.

Installation into Laravel 8 following documentation fails at `npx tailwindcss` stage

See original GitHub issue

Describe the problem:

Installing using the Laravel-specific installation guide fails when creating tailwind.config.js file with error Cannot find module 'autoprefixer'.

Minimal reproduction:

> laravel new twtest

> cd twtest

> npm install

> npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

> npx tailwindcss init
npx: installed 84 in 5.511s
Cannot find module 'autoprefixer'
Require stack:
- /Users/adam/.npm/_npx/16279/lib/node_modules/tailwindcss/lib/cli/commands/build.js
- /Users/adam/.npm/_npx/16279/lib/node_modules/tailwindcss/lib/cli/commands/index.js
- /Users/adam/.npm/_npx/16279/lib/node_modules/tailwindcss/lib/cli/main.js
- /Users/adam/.npm/_npx/16279/lib/node_modules/tailwindcss/lib/cli.js

Versions:

> npm -v
6.14.8
> php artisan -V
Laravel Framework 8.16.1
> cat package.json
{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "autoprefixer": "^9.8.6",
        "axios": "^0.19",
        "cross-env": "^7.0",
        "laravel-mix": "^5.0.1",
        "lodash": "^4.17.19",
        "postcss": "^7.0.35",
        "resolve-url-loader": "^3.1.0",
        "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.1"
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jiaming10commented, Dec 4, 2020

If you don’t want to upgrade NodeJS/NPM, you may try running npx tailwindcss-cli@latest init -p.

1reaction
adamhopkinsoncommented, Nov 30, 2020

@rmahmood19 that also worked for me, thank you.

This does feel a bit wrong, though - the latest version of node is v14.15.1 (according to n stable).

Instructions for upgrading node

  1. Install n, node’s version manager: npm install -g n
  2. Install the latest version of node: n latest
Read more comments on GitHub >

github_iconTop Results From Across the Web

Laravel 8 Installing Tailwind CSS ModuleBuildError
when trying to install tailwind CSS using the npm command. npm install tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat ...
Read more >
Installation - Tailwind CSS
The simplest and fastest way to get up and running with Tailwind CSS from scratch is with the Tailwind CLI tool.
Read more >
Laravel 8 Jetstream - Tailwind CSS not working - Laracasts
When I tried to use Tailwind CSS in welcome blade view, I'm not getting anything formatted like it should be under Tailwind CSS....
Read more >
How to install and build TailwindCSS v2 with Laravel Mix
Most tools haven't yet updated, as explained in their documentation. "Tailwind CSS depends on PostCSS 8. Because PostCSS 8 is only a few...
Read more >
Setting Up TailwindCSS on Laravel | Scout APM Blog
Now after Laravel installation is complete, run the following command to create your ... The next step is installing Tailwind CSS via npm....
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