Why executing npm --version in WSL2 as specific user resulting bad interpreter: no such file or directory?

Viewed 953

I'm trying to check installed npm in WSL2 Ubuntu 20.04.

I run this command

npm --version

It resulted

-bash: /mnt/c/ProgramData/scoop/apps/nodejs/current/npm: /bin/sh^M: bad interpreter: No such file or directory

But if I switch to root user, by executing below command:

sudo su

I can check npm version

root@LAPTOP:/home/user/folder/web/src# npm --version
6.14.4
root@LAPTOP:/home/user/folder/web/src#

Why when I execute using non root user, I can not run npm command. Seem like it's trying to mount from c drive mounting by wsl.

0 Answers
Related