简体   繁体   English

尝试使用 YUM 为 Node.JS 安装 NPM

[英]Trying to install NPM for Node.JS using YUM

I am trying to get Node.JS working using this tutorial.我正在尝试使用本教程让 Node.JS 工作 I have managed to get node.js installed throuhg PuTTy, using the command:我已经设法使用以下命令通过 PuTTy 安装了 node.js:

yum install -y nodejs

And that seemed to work fine (I might have had to use sudo, I can't remember now)这似乎工作正常(我可能不得不使用 sudo,我现在不记得了)

I am really new to command line interfaces so please bear with me.我对命令行界面真的很陌生,所以请耐心等待。

I also ran (from another webpage):我也跑了(从另一个网页):

yum -y groupinstall "Development Tools"

Which also seemed to work fine, but didn't seem to install npm anywhere :(这似乎也工作正常,但似乎没有在任何地方安装npm :(

Now, I can run and execute .js files from the command line using node file.js , and that seems to work fine.现在,我可以使用node file.js从命令行运行和执行 .js 文件,这似乎工作正常。 But now I am stuck in the above tutorial where it says to install Express.但是现在我被困在上面的教程中,它说要安装Express。 It says to run the command:它说要运行命令:

npm install express

Except I don't seem to have the command npm .除了我似乎没有命令npm I read somewhere that it no longer comes with the latest version of Node.JS, so what can I do?我在某处读到它不再附带最新版本的 Node.JS,那我该怎么办? On all of my google searches, I can't seem to find a yum command to install expressjs or npm .在我所有的谷歌搜索中,我似乎找不到安装expressjsnpmyum命令。 Can anyone help me?谁能帮我?

npm is a package on his own and you need to install it sepatately from nodejs npm是他自己的一个包,你需要从 nodejs 单独安装它

sudo yum install nodejs npm

Where is a chance you'll need to use an EPEL repository (depends on your distro)您需要使用 EPEL 存储库的机会在哪里(取决于您的发行版)

sudo yum install nodejs npm --enablerepo=epel

BTW, official documentation on "Installing Node.js via package manager" located on official site: https://nodejs.org/en/download/package-manager/顺便说一句,官方网站上关于“通过包管理器安装 Node.js”的官方文档: https : //nodejs.org/en/download/package-manager/

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

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