NodeJS:如何修复不同的节点模块版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45761864/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:26:26  来源:igfitidea点击:

NodeJS: How to fix different node module version?

node.js

提问by user3142695

I'm trying to start a nodeJS application, but I do get the error

我正在尝试启动一个 nodeJS 应用程序,但我确实收到了错误

Error: The module '/Users/api/node_modules/bcrypt/lib/binding/bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

I already run npm installand npm rebuild. But still the same error...

我已经运行npm installnpm rebuild。但是还是一样的错误...

回答by robertklep

The bcryptpackage needs to be rebuild, because it was initially installed with another version of Node.js.

bcrypt包需要重建,因为它最初是与另一个版本的 Node.js 一起安装的。

Try this:

尝试这个:

npm rebuild bcrypt --update-binary