node.js redis-server - 找不到命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22362674/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 17:01:02  来源:igfitidea点击:

redis-server - Command Not Found

node.jsredis

提问by tommyd456

Totally new to nodejs and redis. Node.js is working fine and NPM works fine too.

对 nodejs 和 redis 来说是全新的。Node.js 运行良好,NPM 也运行良好。

I want to play around with Redis so I ran:

我想玩 Redis 所以我跑了:

npm install redis

and this seemed to work ok but now I'm trying to run:

这似乎工作正常,但现在我正在尝试运行:

redis-server

and I'm getting a Command Not Founderror. I'm on a Mac if that's relevant.

我收到了未找到命令的错误。如果相关,我在 Mac 上。

Can anyone offer some advice?

任何人都可以提供一些建议吗?

回答by hobbs

npm install redisdoesn't install redis, it installs a redis clientfor node. You need to install the redis server.

npm install redis不安装 redis,它为 node安装了一个 redis客户端。你需要安装redis服务器。

回答by robert king

I downloaded http://download.redis.io/redis-stable.tar.gz

我下载了 http://download.redis.io/redis-stable.tar.gz

tar xvzf redis-stable.tar.gz
cd redis-stable
make

I added this line to my .bash_profile:

我将此行添加到我的.bash_profile

export PATH=$PATH:$HOME/Downloads/redis-stable/src

restarted the terminal. Now can run redis-server

重新启动终端。现在可以运行redis-server

回答by Barclay Koin

I believe the answer is above but also this worked for me

我相信答案在上面,但这也对我有用

  1. Download this http://download.redis.io/redis-stable.tar.gz(just paste the link on Opera)
  2. Open a terminal and cd to the folder that has the files (mostly it's in downloads folders) and try something like this
    tar xvzf file.tar.gz
    cd redis-stable
    make
    
  1. 下载这个http://download.redis.io/redis-stable.tar.gz(只需将链接粘贴到 Opera 上)
  2. 打开终端并 cd 到包含文件的文件夹(主要位于下载文件夹中)并尝试这样的操作
    tar xvzf file.tar.gz
    cd redis-stable
    make
    

回答by Jian Zhang

Make sure the command redis-servercan use directly. If you install Redis before , find the path where your Redis install. eg : /home/prod/redis/redis-4.0.8/src/redis-server Then you can command this in terminal :

确保该命令redis-server可以直接使用。如果您之前安装过 Redis,请找到您的 Redis 安装路径。例如:/home/prod/redis/redis-4.0.8/src/redis-server 然后你可以在终端命令这个:

 ln -s /home/prod/redis/redis-4.0.8/src/redis-server /usr/bin/redis-server2

Note: path "/usr/bin" is your environment path .

注意:路径“/usr/bin”是您的环境路径。

cd /usr/bin ls -ltr you can see :

cd /usr/bin ls -ltr 你可以看到:

lrwxrwxrwx    1 root root         45 7月  12 11:05 redis-server -> /home/prod/redis/redis-4.0.8/src/redis-server

Now the command of redis-servercan be used

现在redis-server可以使用的命令