tailwindcss: Can't run local installation of tailwind on windows with npx

This is very strange, perhaps an npx issue

  1. npm i -D tailwindcss
  2. nodemodules\.bin\tailwind produces usage message as expected
  3. npx tailwind errors

image

I’ve no idea why windows scripthost is being run and not nodejs. Must be somehting in your config on windows?

The error is a trailing , in your object literals, no doubt as scripthost is a crappy old version of JS.

This doesn’t happen with other things I tried in .bin like rimraf. There’s no obvious difference between the scripts or cmd files though, I think these are created for the package anyway.

PS the usage message show cli which I think should be tailwind.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I checked on my Windows machine, and as long as the tailwind config file is named tailwind.js, mine errors out. A dialog box doens’t show up like that, but it does appear that npx is trying to run the config file. If I rename my config file to tailwind-config.js it works perfectly. I hope that helps!

Don’t mind me, just adding some keywords for google for the next person, since it’s in an image! Took me a bit to find this! Solution: Just rename to tailwind.js to tailwind.config.js!

Windows Script Host Expected identifier, string or number Microsoft JScript compilation error

It seems like npx tailwind is maybe trying to run your local tailwind.js config file as if it was a script instead of running the actual Tailwind CLI?

Yes, I have the same issue.

As per @kevindqc I will leave this here because this also helped me with the “Microsoft JScript runtime error” alert dialog appearing

just replace the tailwind.js file to tailwind.config.js and run the tailwind cli command npx tailwind build src/css/tailwind.src.css -c tailwind.config.js -o src/css/tailwind.css , file will be compiled. If windows command line wont compile the file just use powershell

I checked on my Windows machine, and as long as the tailwind config file is named tailwind.js, mine errors out. A dialog box doens’t show up like that, but it does appear that npx is trying to run the config file. If I rename my config file to tailwind-config.js it works perfectly. I hope that helps!

Give him a medal ❤️