4

Having problems running npm install redis. Got error:

npm WARN install Refusing to install redis as a dependency of itself

When I tried to install hiredis it would appear to install just fine however, when I tried to run any of the examples they would fail with the required file "redis" not found.

I did finally solve this by installing redis global or:

npm install -g redis

Has anyone else seen this?

PhilMDev
  • 351
  • 3
  • 6

2 Answers2

10

Ensure your app package.json name is not redis.


Good package.json

{
  "name": "redis-app"
  //...
}

Bad package.json

{
  "name": "redis"
  //...
}
Ryan Schumacher
  • 1,816
  • 2
  • 21
  • 33
2

Matthew's comment is correct. This error will occur when your folder name is the same as an NPM module. So just change your folder name from redis to redisApp or something.

Scott Silvi
  • 3,059
  • 5
  • 40
  • 63