tailwind-csstailwind-css-3

Issues installing Tailwindcss, specifically with "npx tailwindcss init"


I'm following the documentation, however when use:

npx tailwindcss init

Not working:

Error: Cannot find module 'C:\path\to\project\tailwindcss\lib\cli.js'


Solution

    1. Check if your directory is initialized as a node project, i.e. it contains package.json file. If not then do this:
    $/> npm init -y
    
    1. Install tailwindcss as a dev dependency (optional as a dev dependency)
    $/> npm i -D tailwindcss