简体   繁体   English

“重新安装 nodejs 后出现错误”

[英]“I got an error after reinstalling nodejs”

node:internal/modules/cjs/loader:1161 return process.dlopen(module, path.toNamespacedPath(filename)); node:internal/modules/cjs/loader:1161 return process.dlopen(module, path.toNamespacedPath(filename)); ^ ^

Error: The module '\?\G:\Discord bot\Bot\ZackyBot\node_modules\canvas\build\Release\canvas.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 83. This version of Node.js requires NODE_MODULE_VERSION 88. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install ).错误:模块 '\?\G:\Discord bot\Bot\ZackyBot\node_modules\canvas\build\Release\canvas.node' 是针对不同的 Node.js 版本使用 NODE_MODULE_VERSION 83 编译的。此版本的 Z3B2819DD4C24EDA2FAF2052EEF449551 需要 NODE_MODULE49551尝试重新编译或重新安装模块(例如,使用npm rebuildnpm install )。 at Object.Module._extensions..node (node:internal/modules/cjs/loader:1161:18) at Module.load (node:internal/modules/cjs/loader:967:32) at Function.Module._load (node:internal/modules/cjs/loader:807:14) at Module.require (node:internal/modules/cjs/loader:991:19) at require (node:internal/modules/cjs/helpers:92:18) at Object.在 Object.Module._extensions..node (node:internal/modules/cjs/loader:1161:18) 在 Module.load (node:internal/modules/cjs/loader:967:32) 在 Function._load. node:internal/modules/cjs/loader:807:14) at Module.require (node:internal/modules/cjs/loader:991:19) at require (node:internal/modules/cjs/helpers:92:18)在 Object。 (G:\Discord bot\Bot\ZackyBot\node_modules\canvas\lib\bindings.js:3:18) at Module._compile (node:internal/modules/cjs/loader:1102:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10) at Module.load (node:internal/modules/cjs/loader:967:32) at Function.Module._load (node:internal/modules/cjs/loader:807:14) at Module.require (node:internal/modules/cjs/loader:991:19) at require (node:internal/modules/cjs/helpers:92:18) at Object. (G:\Discord bot\Bot\ZackyBot\node_modules\canvas\lib\bindings.js:3:18) 在 Module._compile (node:internal/modules/cjs/loader:1102:14) 在 Object.Module._extensions ..js (node:internal/modules/cjs/loader:1131:10) 在 Module.load (node:internal/modules/cjs/loader:967:32) 在 Function.Module._load (node:internal/modules/ cjs/loader:807:14) 在 Module.require (node:internal/modules/cjs/loader:991:19) 在 require (node:internal/modules/cjs/helpers:92:18) 在 Object。 (G:\Discord bot\Bot\ZackyBot\node_modules\canvas\lib\canvas.js:9:18) at Module._compile (node:internal/modules/cjs/loader:1102:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10) at Module.load (node:internal/modules/cjs/loader:967:32) { code: 'ERR_DLOPEN_FAILED' } (G:\Discord bot\Bot\ZackyBot\node_modules\canvas\lib\canvas.js:9:18) 在 Module._compile (node:internal/modules/cjs/loader:1102:14) 在 Object.Module._extensions ..js (node:internal/modules/cjs/loader:1131:10) 在 Module.load (node:internal/modules/cjs/loader:967:32) { code: 'ERR_DLOPEN_FAILED' }

It seems like you installed a newer version of NodeJS than earlier.看起来您安装了比以前更新的 NodeJS 版本。 But you did not compile your project ZackyBot 's node modules using the current version of the NodeJS you installed.但是您没有使用您安装的当前版本的 NodeJS 编译您的项目ZackyBot的节点模块。

I would suggest you go to your project directory and clean all your node modules.我建议您将 go 到您的项目目录并清理所有节点模块。 Then reinstall them again.然后重新安装它们。 Follow the steps below:请按照以下步骤操作:

  1. Delete node_modules directory inside ZackyBot directory删除node_modules目录中的ZackyBot目录
  2. Execute npm install command on a terminal from ZackyBot directoryZackyBot目录在终端上执行npm install命令

Since you updated your nodeJS version to a newer one, you need to update your canvas too.由于您将 nodeJS 版本更新为较新的版本,因此您也需要更新 canvas。

run npm install canvas and you should be good to go.运行npm install canvas你应该对 go 很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM