简体   繁体   中英

Can't install Node.JS on linux machine

I am struggling to install Node.JS on a linux machine. When I run brew install node , I get this output

```[c_test@whatever-server ~]$ brew install node
==> Installing dependencies for curl: glibc, gcc, pkg-config and openssl@1.1
==> Installing curl dependency: glibc
==> Downloading https://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.gz
Updating Homebrew...
######################################################################## 100.0%
==> ../configure --disable-debug --disable-dependency-tracking --disable-silent-rules --prefix=/home/c_test/.linuxbrew/Cellar/glibc/2.23 --enable-obsolete-rpc --without-selinux --with-binutils=/home/c_
Last 15 lines from /home/c_test/.cache/Homebrew/Logs/glibc/01.configure:
checking version of gmake... 3.81, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.17, ok
checking for makeinfo... no
checking for sed... sed
checking version of sed... 4.2.1, ok
checking for gawk... gawk
checking version of gawk... 3.1.7, ok
checking if gcc -B/home/c_test/.linuxbrew/opt/binutils/bin/ is sufficient to build libc... no
checking for nm... nm
configure: error: 
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.

READ THIS: https://docs.brew.sh/Troubleshooting```

I guess the gcc version is the good one:

gcc (GCC) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I have a similar error when I try to build it from source:

./configure
WARNING: C++ compiler (CXX=g++, 4.4.7) too old, need g++ 6.3.0 or clang++ 8.0.0
ERROR: Did not find a new enough assembler, install one or build with
       --openssl-no-asm.
       Please refer to BUILDING.md

You are right, your compiler is out dated.

Nodesource has a pretty easy setup installer for node js based on your system and architecture which it checks automatically. Using apt/apt-get will usually also update the dependencies (eg gcc,g++):

See https://github.com/nodesource/distributions and for the latest

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs

# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_13.x | bash -
apt-get install -y nodejs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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