Home > Back-end >  npm show "NPM ELF : not found error" in WSL
npm show "NPM ELF : not found error" in WSL

Time:09-14

i got error when running npm, i've allready try to reinstall with

sudo apt-get remove nodejs npm -y && sudo apt-get install nodejs npm -y

this problem still exist

/usr/bin/node: 1: ELF: not found
/usr/bin/node: 2: : not found
/usr/bin/node: 4: Syntax error: Unterminated quoted string

im using Ubuntu WSL

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

Linux localhost 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux

npm -v command

npm -v
-bash: /usr/bin/node: cannot execute binary file: Exec format error

CodePudding user response:

i found same problem in github

https://github.com/microsoft/WSL/issues/8151

then i fix this problem with

wget https://gist.githubusercontent.com/lexavey/155a95d803224d7c0af7e225d0d82396/raw/3b4c103e4c3ff702674f96dd12cc412e9c8766ad/fixexec.py
sudo python3 ./fixexec.py $(realpath $(command -v node))
node -v

hope help other with same problem

  • Related