node.js - 错误 : The module . ..是使用 NODE_MODULE_VERSION 57 针对不同的 Node.js 版本进行编译的。此版本的 Node.js 需要

标签 node.js compilation blockchain hyperledger-composer ibm-blockchain

我在尝试解决此错误时遇到了很多麻烦。

所以,首先,我尝试使用 super 账本 Composer ,当我运行 Composer 时,它会抛出以下错误:

    composer
internal/modules/cjs/loader.js:718
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '/usr/local/lib/node_modules/composer-cli/node_modules/node-report/api.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/composer-cli/node_modules/node-report/index.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)

我多次尝试卸载并重新安装,尝试重建等等。 它根本不起作用

如果您能帮助我,我将不胜感激!

最佳答案

package-lock.json 可能就是这个原因。删除 Node 模块和锁定文件并重新安装应该可以解决您的问题。

尝试运行以下内容。

rm package-lock.json
rm -rf node_modules
npm i

检查 Composer 的 Node 版本要求并尝试使用该版本进行安装。安装nvm以方便 Node 版本管理。

关于node.js - 错误 : The module . ..是使用 NODE_MODULE_VERSION 57 针对不同的 Node.js 版本进行编译的。此版本的 Node.js 需要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51963969/

相关文章:

node.js - 如何获取错误: Cannot set headers after they are sent to the client is thrown?所在的行

node.js - Socket.io 替代方案

node.js - 抓取 Netflix

hyperledger-fabric - super 账本结构 : failed to execute transaction: timeout expired

database - 我们可以存档 AWS QLDB 数据吗,因为每个企业对可以存储的历史记录量都有限制

r - 如何在 R 中生成随机的 64 位十六进制数?

android - 当应用程序被终止时未收到通知 FCM 与 Firebase 的 Cloud Functions

vim - 从 Vim 编译 Actionscript

scala - 为什么添加 import `import cats.instances.future._` 会导致隐式 Functor[Future] 编译错误

c# - 为什么异常总是被接受为返回类型(抛出时)?