Search code examples
node.jsmeteornode-modulesbcryptnode-gyp

bcrypt@2.0.1 trying to download from wrong url results 404. How to fix?


I'm trying to revive ancient application on a new server. This application runs on meteor 1.5.1 and nodejs 4.8.4. In a package.json I've "bcrypt": "^2.0.1", entry. When I try to install packages by running meteor npm install --save it's trying to download bcrypt from wrong URL, which results 404. Below is the error output..

# meteor npm install --save

> bcrypt@2.0.1 install /my-app/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v2.0.1/bcrypt_lib-v2.0.1-node-v72-linux-x64-glibc.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@2.0.1 and node@12.18.4 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
make: Entering directory '/my-app/node_modules/bcrypt/build

As you can see from the output, it's trying to download from nonexistent (wrong) url. Correct url should be: https://github.com/kelektiv/node.bcrypt.js/releases/download/v2.0.1/bcrypt_lib-v2.0.1-node-v46-linux-x64-glibc.tar.gz Because nodejs 4.8.4's modules version is v46. I'm not sure why it's trying to download for node@12.18.4 at first place.

Problem is fallback build is not even compiling.. Giving C++ errors all over place. I assume if I could somehow fix the pre-built binary issue, I could avoid fallback build problem? How can I point it to correct url or is it possible to at least download the tar.gz file beforehand and put it somewhere?


Solution

  • I've finally found an answer! I was running meteor npm install --save command as different user than expected. In a result meteor npm install --save command downloaded whole new nodejs version in that user's PATH and tried to install packages. Problem is solved by running meteor npm install --save command in correct user's environment.