skip to Main Content

When I tried to add flutter to windows environment, my WSL is not happy Im getting this error.

/usr/bin/env: ‘bashr’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

enter image description here

This will only happen if I add flutter to windows environment variables.

Any tips how I can fix this?

2

Answers


  1. Chosen as BEST ANSWER

    The cause of the problem was, when I add the flutter command on the windows environment variables path, all the windows env will be also carried on the WSL this will in turn make the windows flutter command have a priority.

    And when I enable the flutter bash completion

    source <(flutter bash-completion)
    

    this will use the flutter executable from windows and bash doesn't like it.

    The simple fix is to priority the wsl local flutter binary.

    export PATH=~/devtools/flutter/bin/:$PATH
    

    This fixed the problem.


  2. Your script is a Windows-formatted text file, which bash doesn’t like, not even in WSL. Save it without the carriage returns.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search