Problem:
Switching between WSL Ubuntu terminal and Windows command line, I've found some various issues. More recently, however, I came across this one while trying to run a simple script:
{ Error: UNKNOWN: unknown error, lstat 'C:\project_path\node_modules\.bin\eslint'
errno: -4094,
code: 'UNKNOWN',
syscall: 'lstat',
path: 'C:\\project_path\\node_modules\\.bin\\eslint' }
Solution:
In my case, the problem has to do with how npm is connecting dependency scripts to my project. In WSL, npm uses symbolic links to create an alias to something located somewhere else; in our case the scripts for these programs are actually nested deeper in the node_modules directory. To allow our program to use them easily, npm creates aliases in the node_modules/.bin directory. However, in Windows, npm creates a bunch of cmd files, which more or less do the same thing, by running the script where it actually resides; deeper in the node_modules/ directory.
To figure this out, I decided to let the operating systems each tell me what it saw in the .bin/ directory (I had run npm install on WSL prior):
On WSL (using ls -l)
eslint -> ../eslint/bin/eslint.js
On Windows (using attrib)
The target of the symbolic link C:\project_path\node_modules\.bin\eslint does not exist
To fix this issue, the easiest/clean solution is to completely remove node_modules/ (verify it is removed on both Windows and WSL!) and then on your chosen operating system (Windows for me), run your npm install command.
No comments:
Post a Comment