简体   繁体   English

如何在wsl中使用节点-zsh:exec格式错误:节点

[英]How to use node in wsl - zsh: exec format error: node

I am using windows 10 linux subsystem - linux 20.04.我正在使用 windows 10 linux 子系统 - linux 20.04。 I have installed brew and using zsh (downloaded with brew).我已经安装了 brew 并使用了 zsh(用 brew 下载)。

The problem is when i have downloaded node with brew as well it does not work and shows me the following error:问题是当我用 brew 下载节点时它也不起作用并显示以下错误:

zsh: exec format error: node

And when i am typing npm:当我输入 npm 时:

/home/linuxbrew/.linuxbrew/bin/node: 1: 0�: not found
/home/linuxbrew/.linuxbrew/bin/node: 1: �: not found
/home/linuxbrew/.linuxbrew/bin/node: 1: ����: not found
/home/linuxbrew/.linuxbrew/bin/node: 1: ʌ�,�/W�%r��@�:,2�F�: not found
/home/linuxbrew/.linuxbrew/bin/node: 1: ELF: not found
/home/linuxbrew/.linuxbrew/bin/node: 1:R�td0�0�E0�E�K�KP�P�EP�E: not found
/home/linuxbrew/.linuxbrew/bin/node: 2: K�/�q: not found
/home/linuxbrew/.linuxbrew/bin/node: 1: 
                                         �
: not found                               �0�0�E0�E�O�
/home/linuxbrew/.linuxbrew/bin/node: 10: Syntax error: ")" unexpected

Thanks for any kind of help:)感谢您提供任何帮助:)

Please see this bug on the WSL github.请在 WSL github 上查看错误。 There currently appear to be two solutions either upgrade to WSL2 or grab the package from nodesource as per this comment from two days ago.根据两天前评论,目前似乎有两种解决方案,要么升级到 WSL2,要么从 nodesource 获取 package。

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs

Exec format error means that the binary for the wrong architecture is being installed - you could try using NVM to install Node - brew and WSL I can't say I've ever used but it wouldn't be my goto solution. Exec 格式错误意味着正在安装错误架构的二进制文件 - 您可以尝试使用NVM安装 Node - brew 和 WSL 我不能说我曾经使用过,但这不是我的 goto 解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM