在WSLUbuntu20.04上安装npm后,我收到消息“/usr/bin/env:'bashr':Nosuchfileordirectory”

从终端运行npm installornpm命令时,我看到以下消息。执行node工作按预期进行。

    > npm install
    /usr/bin/env: ‘bashr’: No such file or directory

回答

这是一个行尾问题,但不是来自 Ubuntu。使用以下命令确保您确实拥有nodenpm正确安装:

sudo apt install nodejs npm

然后通过/etc/wsl.conf在 WSL 中编辑文件来停止与 WSL 共享的 Windows 路径变量。如果文件不存在,sudo touch /etc/wsl.conf请先执行。使用命令编辑文件sudo nano /etc/wsl.conf并添加以下配置:

[interop]
appendWindowsPath = false

然后wsl --shutdown在 Windows 中使用命令重新启动 WSL2 。

注意:这也会影响pyenv命令,请参阅/usr/bin/env: 'bashr': No such file or directory: Incompatible line-endings (WSL?)


以上是在WSLUbuntu20.04上安装npm后,我收到消息“/usr/bin/env:'bashr':Nosuchfileordirectory”的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>