nativewind / nativewind

React Native utility-first universal design system - powered by Tailwind CSS
https://nativewind.dev
MIT License
5.42k stars 287 forks source link

CLI Fails When Folder Path Contains Spaces (Windows Environment) #1337

Closed Amir-A-M closed 2 weeks ago

Amir-A-M commented 2 weeks ago

Hello

Description

The TailwindCSS CLI fails to execute commands when the project is located in a directory path containing spaces. This issue occurs during the build process, as paths with spaces are not handled properly.

  1. Expo project with nativewind and gluestack ui
  2. After runing npm run start command. I will get this Log:
    Error running TailwindCSS CLI, please run the CLI manually to see the error.
    Command used:  node D:\__ project\movie-db\node_modules\tailwindcss\lib\cli.js --input "D:\__ project\movie-db\src\styles\global.css" --output "D:\__ project\movie-db\node_modules\.cache\nativewind\global.css.web.css" --watch
  3. Run the used command in above Log:
    node D:\__ project\movie-db\node_modules\tailwindcss\lib\cli.js --input "D:\__ project\movie-db\src\styles\global.css" --output "D:\__ project\movie-db\node_modules\.cache\nativewind\global.css.web.css" --watch
  4. The Error:
    
    node:internal/modules/cjs/loader:1147cCollege\x5cmovie-db\x5cnode_modules\x5c.cache\x5cnativewind\x5cglobal.css.web.css" --watch;b4d4f91b-3efb-433c-85f6-d86fe3ac173d
    throw err;
    ^

Error: Cannot find module 'D:__' at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15) at Module._load (node:internal/modules/cjs/loader:985:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v20.10.0


## Expected Behavior
the path should be in `double quotes (")` so spaces in folder names wouldn't trow error
```bash
❌ Wont Work:
node D:\__ project\movie-db\node_modules\tailwindcss\lib\cli.js
✅ Will Work:
node "D:\__ project\movie-db\node_modules\tailwindcss\lib\cli.js"

Environment

Node.js version: v20.10.0 TailwindCSS version: ^3.4.15 Operating System: Windows 10 NativeWind version: ^4.0.36

Is This related to NativeWind?

Thanks for reading

marklawlor commented 2 weeks ago

Can you upgrade to v4.1, it changed how this logic works and may resolve this issue

Amir-A-M commented 2 weeks ago

Thanks it fixed it 🙏 I also had some other bugs struggling with, updating to this version fixed them.