This article mainly introduces the installation steps of Nodejs in Linux (complete and detailed), which has some reference value. if you are interested, refer to it. I have installed a node in windows and a Mac before, and it is very convenient. I have been installing a node in linux for a long time. I would like to record it here.
First, go to the official website to download the Code. There are two installation methods: Source Code and compiled files. I am operating the compiled files according to the installation method of the online source code, and the result has been stuck for a long time.
(1) compiled files
In the red box, you can download the compiled file and select the corresponding linux version. Simply put, after decompression, the node and npm already exist in the bin folder, if you enter the corresponding file and execute the command line, there is no problem at all, but it is not global, so you can set this to global by creating a soft link.
tar xf node-v5.10.1-linux-x64.tar.gz -C /usr/local/ cd /usr/local/ mv node-v5.10.1-linux-x64/ nodejs ln -s /usr/local/nodejs/bin/node /usr/local/bin ln -s /usr/local/nodejs/bin/npm /usr/local/bin
(2) source code compilation
In this way, the file you downloaded is Source code, because my linux version is 6. x. The default gcc-c ++ version is 4.4.7. after the gcc-c ++ version is compiled, the gcc-c ++ version must be 4.8 at the lowest, so I went to upgrade the GCC-C ++ version, the result is because of the source code compilation upgrade GCC-C ++, compiled for more than an hour, did not complete the compilation! Decisively attacked...
root># ./configure WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++) creating ./icu_config.gypi { 'target_defaults': { 'cflags': [], 'default_configuration': 'Release', 'defines': [], 'include_dirs': [], 'libraries': []}, 'variables': { 'asan': 0, 'gas_version': '2.20', 'host_arch': 'x64', 'icu_small': 'false', 'node_byteorder': 'little', 'node_install_npm': 'true', 'node_prefix': '/usr/local', 'node_release_urlbase': '', 'node_shared_http_parser': 'false', 'node_shared_libuv': 'false', 'node_shared_openssl': 'false', 'node_shared_zlib': 'false', 'node_tag': '', 'node_use_dtrace': 'false', 'node_use_etw': 'false', 'node_use_lttng': 'false', 'node_use_openssl': 'true', 'node_use_perfctr': 'false', 'openssl_fips': '', 'openssl_no_asm': 0, 'target_arch': 'x64', 'uv_parent_path': '/deps/uv/', 'uv_use_dtrace': 'false', 'v8_enable_gdbjit': 0, 'v8_enable_i18n_support': 0, 'v8_no_strict_aliasing': 1, 'v8_optimized_debug': 0, 'v8_random_seed': 0, 'v8_use_snapshot': 'true', 'want_separate_host_toolset': 0}} creating ./config.gypi creating ./config.mk WARNING: warnings were emitted in the configure phase
(3) apt-get
Another method is the apt-get Method in wubantu. I was stuck in this method before.
sudo apt-get install nodejs sudo apt-get install npm
After installation, you will find that the node command is not easy to use. the nodejs command can be used...
The above is all the content of this article. I hope it will help you learn and support PHP.
For more articles about Nodejs installation steps in Linux, refer to PHP Chinese network!