xSh*_*ase 5 bash node.js windows-10 windows-subsystem-for-linux
我正在尝试使用语法从 WT 在 WSL 中运行 node.js 脚本wsl.exe <command>。
但是,当以这种方式启动时,我无法让它找到 Node 并得到以下信息:
PS C:\> wsl.exe -- node -v
/bin/bash: node: command not found
Run Code Online (Sandbox Code Playgroud)
在 WSL 中,节点已安装并按预期工作:
/mnt/c$ node -v
v14.13.0
Run Code Online (Sandbox Code Playgroud)
在 bash 脚本中以防万一:
// test.sh
#!/bin/bash
node -v
/mnt/c$ ./test.sh
v14.13.0
PS C:\> wsl.exe -- ./test.sh
/mnt/c/test.sh: line 2: node: command not found
Run Code Online (Sandbox Code Playgroud)
我做错了什么?