为什么在运行npm install时在bcrypt中出现错误404?

Im trying to run sudo npm install in my project and I got the next error: Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v64-linux-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.3 and node@10.15.3 (node-v64 ABI) (falling back to source compile with node-gyp) node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v64-linux-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.3 and node@10.15.3 (node-v64 ABI) (falling back to source compile with node-gyp)

我使用的是10.15.3节点版本和6.4.1 npm版本。

如何解决此错误?

评论
  • wearum
    wearum 回复

    Remove the node modules file. Then install bcrypt by manually using sudo npm i bcrypt --save. Then run the command sudo npm i.

    If this is not working try it without sudo command.

  • equia
    equia 回复

    As it look to be a problem with node gyp. First install build-essential in linux.

    sudo apt-get install build-essential
    

    After that you need to install python-dev

    sudo apt-get install python-dev
    

    That is it, now you need reinstall your bcrypt package.