npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.35k stars 3.08k forks source link

[BUG] Windows monorepo only: EISDIR: illegal operation on a directory, symlink #6005

Open remcohaszing opened 1 year ago

remcohaszing commented 1 year ago

Is there an existing issue for this?

This issue exists in the latest npm version

Current Behavior

Running npm install in a mono repo in Windows causes an error:

npm ERR! code EISDIR
npm ERR! syscall symlink
npm ERR! path Z:\vscode-mdx\demo
npm ERR! dest Z:\vscode-mdx\node_modules\@mdx-js\monaco-demo
npm ERR! errno -4068
npm ERR! EISDIR: illegal operation on a directory, symlink 'Z:\vscode-mdx\demo' -> 'Z:\vscode-mdx\node_modules\@mdx-js\monaco-demo'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\remco\AppData\Local\npm-cache\_logs\2022-12-29T15_29_33_735Z-debug-0.log

Expected Behavior

I expect to be able to run npm install in a mono repo in Windows.

Steps To Reproduce

  1. Using Windows, clone remcohaszing/vscode-mdx and switch to the intellisense branch.
    git clone git@github.com:remcohaszing/vscode-mdx.git
    cd vscode-mdx
    git switch intellisense
  2. Now run npm install
  3. This results in the error described above

Environment

prefix = "C:\Users\remco\AppData\Roaming\npm"

; "project" config from Z:\vscode-mdx.npmrc

package-lock = false

; "cli" config from command line options

location = "project"

; node bin location = C:\Program Files\nodejs\node.exe ; node version = v19.3.0 ; npm local prefix = Z:\vscode-mdx ; npm version = 9.2.0 ; cwd = Z:\vscode-mdx ; HOME = C:\Users\remco ; Run npm config ls -l to show all defaults.

HatemMn commented 5 months ago

Was this error fixed ? I think it originates from your package name (@mdx-js\monaco-demo) that looks like a windows directory. I have the same error on Windows, this should be fixed by putting an escape on ' \ ' characters as they are cummon in package names

remcohaszing commented 5 months ago

I just reproduces the issue with Node.js 21.7.3, npm 10.5.0, and MDX analyzer commit dcb89a9202449b28ae1cfb079b3f82ec9ba41afc