Home  >  Article  >  Operation and Maintenance  >  How to solve the problem that centos npm command cannot be found

How to solve the problem that centos npm command cannot be found

藏色散人
藏色散人Original
2022-01-28 14:52:3711432browse

centos npm command cannot find the solution: 1. Use epel to install node; 2. Install npm and express; 3. Close xshell; 4. Restart.

How to solve the problem that centos npm command cannot be found

The operating environment of this article: CentOS 7 system, node 0.10.25, DELL G3 computer

How to solve the problem that the centos npm command cannot be found Got a question?

Install npm under centos. Solve the problem of installing node under centos: command not found

Install

# wget http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz

yum install gcc openssl-devel gcc-c compat-gcc-34 compat-gcc-34-c

tar -xf node-v0.10.25.tar.gz# cd node-v0.10.25

# ./configure --prefix=/usr/local/node

make && make install

# ln -s /usr /local/node/bin/* /usr/sbin/

After the installation is completed, npm is also automatically installed.

Test

# node -v

#npm -v

Note: Sometimes after successful installation, xshell needs to be closed and restarted. nvm will take effect.

1. When installing node under linux, the prompt -bash: node: command not found.

2. In this case, you can use epel to install node:

sudo yum install epel-release

sudo yum install nodejs

node --version

How to solve the problem that centos npm command cannot be found

How to solve the problem that centos npm command cannot be found

How to solve the problem that centos npm command cannot be found

##Outputting the version information proves that the installation is successful.

3. Install npm and express:

sudo yum install npm --enablerepo=epel

## sudo npm install - g express

sudo npm install -g express-generator

OK.

Recommended: "

centos usage tutorial

"

The above is the detailed content of How to solve the problem that centos npm command cannot be found. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn