1

To minify my tailwindCSS, I tried creating a script in my package.json:

"tw:prod":"NODE_ENV=production npx tailwindcss-cli@latest build ./src/css/tailwind.css -o ./public/css/tailwind.css",

but it gives this error:

> 'NODE_ENV' is not recognized as an internal or external command,
> operable program or batch file. npm ERR! code ELIFECYCLE npm ERR!
> errno 1 npm ERR! ntwport@1.0.0 tw:prod: `NODE_ENV=production npx
> tailwindcss-cli@latest build ./src/css/tailwind.css -o
> ./public/css/tailwind.css` npm ERR! Exit status 1 npm ERR! npm ERR!
> Failed at the ntwport@1.0.0 tw:prod script. npm ERR! This is probably
> not a problem with npm. There is likely additional logging output
> above.
> 
> npm ERR! A complete log of this run can be found in: npm ERR!    
> C:\Users\gabri\AppData\Roaming\npm-cache\_logs\2021-01-08T10_21_19_799Z-debug.log

The script is found in tailwincss's docs, so why is it giving this error?

  • 1
    Hey Timmy, welcome to the community. May your question be solved with this one right here? (probably since I noticed you are using Windows) https://stackoverflow.com/questions/11928013/node-env-is-not-recognized-as-an-internal-or-external-command-operable-comman – Tommy Jan 08 '21 at 10:38
  • 1
    @tommygun I think so, thanks – timmy adolf Jan 08 '21 at 10:53
  • Does this answer your question? ["NODE\_ENV" is not recognized as an internal or external command, operable command or batch file](https://stackoverflow.com/questions/11928013/node-env-is-not-recognized-as-an-internal-or-external-command-operable-comman) – Tommy Jan 08 '21 at 11:07

1 Answers1

0

If you run a windows system, you need to install win-node-env dev dependencies. then you run for tw:prod:

npm install win-node-env
Sven Eberth
  • 3,057
  • 12
  • 24
  • 29