Skip to content

[Windows] npm fails to install optional native dependencies (lightningcss, @tailwindcss/oxide) #59

Description

@rbctmz

Description

On Windows, npm install fails to properly install optional native dependencies required for the project, specifically:

  • lightningcss-win32-x64-msvc
  • @tailwindcss/oxide-win32-x64-msvc
  • @rollup/rollup-win32-x64-msvc

This is a known npm bug related to optional dependencies: npm/cli#4828

Environment

  • OS: Windows 11
  • Node.js: v22.14.0
  • npm: (version included with Node.js)
  • Project version: 0.0.6

Steps to Reproduce

  1. Clone the repository:

    git clone https://github.com/vakovalskii/LocalDesk.git
    cd LocalDesk
  2. Install dependencies:

    npm install
  3. Try to run development mode:

    npm run dev:win

Expected Behavior

The application should start successfully with all native dependencies properly installed.

Actual Behavior

Error 1: Rollup

Error: Cannot find module @rollup/rollup-win32-x64-msvc

Error 2: Lightningcss

Error: Cannot find module '../lightningcss.win32-x64-msvc.node'
Require stack:
- C:\Users\...\LocalDesk\node_modules\@tailwindcss\node\node_modules\lightningcss\node\index.js

Error 3: Tailwind Oxide

Error: Cannot find native binding. npm has a bug related to optional dependencies
(https://github.com/npm/cli/issues/4828)

Workaround

After running npm install, manually install the missing native modules:

# Install missing native dependencies
npm install @rollup/rollup-win32-x64-msvc --save-dev --force
npm install lightningcss-win32-x64-msvc@1.31.1 --save-dev --force
npm install @tailwindcss/oxide-win32-x64-msvc@4.1.18 --save-dev --force

Then run the application:

# Terminal 1 - Start Vite dev server
npm run dev:react

# Terminal 2 - Start Electron
$env:NODE_ENV="development"; npx electron . --no-sandbox

Suggested Fix

Update the README.md to include Windows-specific installation instructions with the workaround, or consider one of these solutions:

Option 1: Document the workaround

Add a troubleshooting section to README.md with the manual installation commands.

Option 2: Add postinstall script

Create a postinstall script that checks for Windows and installs these dependencies explicitly:

{
  "scripts": {
    "postinstall": "electron-rebuild -f -w better-sqlite3 || true && node scripts/fix-windows-deps.js"
  }
}

Option 3: Use different package manager

Document that Windows users can use yarn or pnpm which handle optional dependencies better:

# Using yarn
yarn install
yarn dev

# Using pnpm  
pnpm install
pnpm dev

Additional Notes

  • This issue is specific to npm on Windows
  • The issue does not occur on macOS/Linux
  • Yarn and pnpm do not have this problem
  • After manual installation of native modules, the application runs correctly

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions