我在尝试解决此错误时遇到了很多麻烦。
所以,首先,我尝试使用 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/