question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hiredis is not being installed

See original GitHub issue
  • Version: 2.7.1
  • Platform: Node.js 8.1.3 / macOS 10.12.5
  • Description: After running yarn or npm install on the project and while generating a webpack build I got this error
ERROR in ./node_modules/redis-parser/lib/hiredis.js
Module not found: Error: Can't resolve 'hiredis' in
error Command failed with exit code 2.

The webpack config is the following:

var path = require('path')

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: ['babel-loader']
      }
    ]
  },
  target: 'node'
}

package.json

{
  "version": "1.0.0",
  "main": "src/index.js",
  "license": "MIT",
  "dependencies": {
    "dotenv": "^4.0.0",
    "koa": "^2.3.0",
    "koa-bodyparser": "^4.2.0",
    "koa-router": "^7.2.1",
    "node-fetch": "^1.7.1",
    "redis": "^2.7.1"
  },
  "devDependencies": {
    "babel-cli": "^6.24.1",
    "babel-loader": "^7.1.1",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-object-rest-spread": "^6.23.0",
    "babel-preset-env": "^1.5.2",
    "webpack": "^3.0.0"
  },
  "scripts": {
    "start": "node dist/bundle",
    "build": "webpack"
  },
  "babel": {
    "presets": [
      [
        "env",
        {
          "targets": {
            "node": "current"
          }
        }
      ]
    ],
    "plugins": [
      "transform-object-rest-spread",
      "transform-class-properties"
    ]
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
guidoboumancommented, Apr 25, 2018

Actually, that’s not an issue with Webpack. That’s an issue with how redis-parser used hiredis. This issue can be solved by upgrading to redis-parser 3.0, which solves exactly this issue.

5reactions
muratgozelcommented, Jul 15, 2017

That must be related with webpack. I was solved this issue by using nodeExternals plugin in webpack config:

const nodeExternals = require('webpack-node-externals')

module.exports = {
  ...
  externals: [nodeExternals()],
  target: 'node'
}

nodeExternals skips any module in node_modules folder at server side bundling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing hiredis fails after upgrading to Python 3.8 #92 - GitHub
While installing hiredis after upgrading to Python 3.8, I am getting error saying error: command 'C:\\Program Files (x86)\\Microsoft Visual ...
Read more >
Installing Hiredis with pip on windows machine - Stack Overflow
I read a lot of blogs and suggestions to this problem but i found no suitable answer. I tried "Windows GCC (MinGW) binaries...
Read more >
[Resolved] Install hiredis failed arm directory or files not found
Hello, I'm trying an installation of Mastodon instance on tinkerboard running with Armbian OS. I follow this topic : documentation/Production-guide.md at ...
Read more >
ERROR: Could not build wheels for hiredis in Python
To solve the error "Could not build wheels for hiredis", run the pip install --upgrade pip command to upgrade your pip version, install...
Read more >
Getting Started - aioredis
This will install aioredis , async-timeout . ... pip install aioredis[hiredis] ... The commands will not be reflected in Redis until execute() is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found