我正在终端上运行一个节点应用程序。最近已经升级到节点v8.5.0,但我得到这个错误:

Error: The module '/tidee/tidee-au/packages/tidee-au-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. 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`).
    at Object.Module._extensions..node (module.js:653:18)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/tidee/tidee-au/packages/tidee-au-server/node_modules/bcrypt/bcrypt.js:6:16)
    at Module._compile (module.js:624:30)
    at Module._extensions..js (module.js:635:10)
    at Object.require.extensions.(anonymous function) [as .js] (/tidee/tidee-au/packages/tidee-au-server/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/tidee/tidee-au/packages/tidee-au-server/server/helpers/encryptPass.js:1:16)

知道怎么解决吗?


当前回答

运行NPM config set python python2.7,再运行NPM install, party is on。

其他回答

你必须重新构建包,并告诉npm更新它也是二进制的。试一试:

npm rebuild bcrypt --update-binary

@robertklep用这个命令回答了一个相关的问题,看。

只有重建还没有解决我的问题,这在我的应用程序工作得很好。

在尝试了不同的东西之后。 这工作。

删除节点模块文件夹并运行

npm i

我也有同样的问题,这里提到的任何方法都对我不起作用。 以下是对我有效的方法:

在main.js文件中要求所有你需要的依赖项,该文件由electron运行。(这对我来说似乎是第一个重要的部分) 执行npm i -D electronic -rebuild命令添加electronic -rebuild包 删除node-modules文件夹,以及packages-lock。json文件。 运行npm i安装所有模块。 运行。/node_modules/.bin/ electronic -rebuild (.\node_modules\.bin\ electronic -rebuild)。cmd for Windows)重新构建所有内容

在npm i之后直接运行。/node_modules/.bin/ electronic -rebuild是非常重要的,否则它在我的mac上无法工作。

我来这里是因为我在vscode中得到这个关于quokka.js ext的错误。

我的解决方案: (在MAC上通过终端)

1-我去~/.quokka

2-我运行nano config.json

3-我从配置中复制了代码。Json放到一个单独的文件中

4-我删除了config.json中的代码

5-我停下来,重新启动短尾矮袋鼠。

6-一旦我确认短尾矮袋鼠工作没有错误,我删除配置。Json文件代码。

你只需要运行下面的命令:

$ rm -rf node_modules
$ rm -rf yarn.lock
$ yarn install

最后

$ ./node_modules/.bin/electron-rebuild

不要忘记yarn添加电子重建,如果它不存在于你的依赖。