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.

Error building bcrypt with node-gyp

See original GitHub issue

I started to have this issues with nuxt/vercel-builder 0.17.12.

[4/5] Building fresh packages...
--
13:29:39.104 | error /vercel/workpath1/node_modules/bcrypt: Command failed.
13:29:39.104 | Exit code: 127
13:29:39.104 | Command: node-pre-gyp install --fallback-to-build
13:29:39.104 | Arguments:
13:29:39.104 | Directory: /vercel/workpath1/node_modules/bcrypt
13:29:39.104 | Output:
13:29:39.104 | /bin/sh: node-pre-gyp: command not found
13:29:39.105 | info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
13:29:40.019 | Error: Command "yarn install" exited with 127
13:29:42.852 | Done with "nuxt.config.js"

Seems, for some reason the bcrypt installation started to fail after version 0.17.7. I made a test today using this version, and the project builded successfully.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:11
  • Comments:31 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
florian-lefebvrecommented, Oct 5, 2021

I think I found a workaround to the resolve this issue.

You can add vercel-build to your package.json to global install node-gyp, you’ll need to add a builds step before @nuxtjs/vercel-builder to ensure it gets installed in the correct order.

// vercel.json
{
  "version": 2,
  "builds": [
    {
      "src": "package.json",
      "use": "@vercel/node"
    },
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "serverFiles": ["server-middleware/**"]
      }
    }
  ],
}
// package.json
{
  "scripts": {
    "vercel-build": "yarn global add node-gyp"
  }
}

It worked for me! I’m using the @supabase/supabase-js package that relies on node-gyp-build so my vercel-build command looks like yarn global add node-gyp-build.

11reactions
kylewelsbycommented, Mar 22, 2021

I think I found a workaround to the resolve this issue.

You can add vercel-build to your package.json to global install node-gyp, you’ll need to add a builds step before @nuxtjs/vercel-builder to ensure it gets installed in the correct order.

// vercel.json
{
  "version": 2,
  "builds": [
    {
      "src": "package.json",
      "use": "@vercel/node"
    },
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "serverFiles": ["server-middleware/**"]
      }
    }
  ],
}
// package.json
{
  "scripts": {
    "vercel-build": "yarn global add node-gyp"
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Solved] bcrypt fails at the install script at node-gyp rebuild
1)Go to visual studio code · 2)Open package.json · 3)Delete bcrypt dependency from package.json · 4)Now open terminal and run npm install bcrypt...
Read more >
Error installing bcrypt with npm - node.js
I managed to solve this by running the command: sudo apt-get install -y build-essential python ...
Read more >
How to resolve node-gyp + bcrypt errors on MacOS
The most common solution on the Interweb for resolving bcrypt errors is to upgrade the dependancy to the lastest version If you have...
Read more >
Cannot find module 'bcrypt' error in Node.js
To solve the error "Cannot find module 'bcrypt'", install the node-gyp and bcrypt packages. The bcrypt module uses node-gyp for its build and...
Read more >
`node-pre-gyp install --fallback-to-build` on Linux - YouTube
How to install bcrypt on Windows and Linux The steps are as follows :Install stable version of node withsudo npm cache clean -fsudo...
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