Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

697
Views
After installing npm on WSL Ubuntu 20.04 I get the message "/usr/bin/env: ‘bash\r’: No such file or directory"

I see the following message when running the npm install or npm command from the terminal. Executing node works as expected.

    > npm install
    /usr/bin/env: ‘bash\r’: No such file or directory
over 4 years ago · Santiago Trujillo
5 answers
Answer question

0

This is a line endings issue, but not from Ubuntu. Make sure you do have node and npm installed correctly by using the command:

sudo apt install nodejs npm

Then stop Windows path variables being shared with WSL by editing the /etc/wsl.conf file in WSL. If the file doesn't exist, execute sudo touch /etc/wsl.conf first. Edit the file with the command sudo nano /etc/wsl.conf and add the following configuration:

[interop]
appendWindowsPath = false

Then restart WSL2 with command wsl --shutdown in Windows.

Note: this also affects pyenv command, see /usr/bin/env: ‘bash\r’: No such file or directory: Incompatible line-endings (WSL?)

over 4 years ago · Santiago Trujillo Report

0

I hit the same issue, after install nodejs and npm, just restart my wsl with wsl --shutdown solved the issue, you can try this.

over 4 years ago · Santiago Trujillo Report

0

This happened to me today after I updated node and npm through nvm. I realized that indeed the .nvm path was missing from echo $PATH. Then I noticed that npm use v16.14.0 would re-add it to $PATH and make npm i work again. However, this only worked for the current tab and to make it work in new sessions/tabs I had to run:

nvm alias default v16.14.0

over 4 years ago · Santiago Trujillo Report

0

Nodejs has been installed outside the WSL, so I typed the NPM command in the WSL window and actually called the NPM on Windows. After uninstalling both Windows and WSL nodes, I reinstalled the NODE in WSL and there is no problem

over 4 years ago · Santiago Trujillo Report

0

I think the better solution would be installing NOde using nvm on WSL, then you won't have this problem.

Installing Node using nvm for Ubuntu 20.04

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!