Resolving "EISDIR: illegal operation on a directory" when using git worktrees with nx

  • You are using nx and you have created a new git worktree from a branch. 
  • You already run "npm i" to install all dependencies
  • Now you are seeing the following error when you try to serve your app


NX   EISDIR: illegal operation on a directory, lstat 'C:'


Root Cause

The nx remote cache. The remote cache has a reference to you local cache. When you switch you local cache still point to you main repository source. Your worktree is living under another folder. Nx tries to read the local cache but fails.

Run to see and details

npx nx serve your-app --verbose


Solution

Skip the remote cache

npx nx serve your-app --skipRemoteCache

Comments

Popular posts from this blog

What is Base, Local & Remote in Git merge

Debug Azure Function locally with https on a custom domain

NPM: Semantic Versioning Characters