Ask coding questions

← Back to all posts
Does brain.js work when I install it with npm?
pauly10

In the shell, I typed in "npm i brain.js" and I am using node version that is greater than 16.0.0. (https://replit.com/talk/learn/Nodejs-14-on-replit/85501).

I then required brain.js above. It outputs an error:
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).

There are more lines of the error. Please run it above :)

Thank you,
Paul 10

Answered by Coder100 [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100

try using the bash language instead
https://repl.new/bash

perhaps its because this node version is just too old (v12)

pauly10

@Coder100 I am using the shell to "update" the node version to a version higher than 16.0.0 like I said above. Do you mean something else or do you mean to update the npm version?

Coder100

i mean a different language, the bash language. please click on the link i gave you. @pauly10

pauly10

@Coder100 How would I proceed after I created a new bash replit? I don't know anything about using bash :(

Thank you,
Pauly10

Coder100

you can use npm i brain.js to install things, and use node . to run the project. Create an index.js to put your code there, and do node . in main.sh to run it! @pauly10

pauly10

@Coder100 I did do that.. but it gives me an error:
UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined

Coder100

is it because brain.js was made for the web? @pauly10

pauly10

@Coder100 No I am coding an AI Discord bot.

pauly10

@Coder100 Okaya here is the problem.... in order to have a discord bot, you need to have at least v16 for node.js however brain.js requires you to have a version less than that.. what should i do?

before I updated the node.js version, brain.js worked fine... but now since I updated it for creating a discord bot, it's like not working...

Coder100

@pauly10 you can use an earlier version like discord v12

pauly10

@Coder100 How can I do that?

Coder100

@pauly10 in the shell tab type npm i [email protected] but first uninstall discord.js in the packager.

pauly10

 bash main.sh
(node:172) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at Client.login (/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/discord.js/src/client/Client.js:228:52)
at Object.<anonymous> (/home/runner/IncompatibleBurdensomeLegacysystem/index.js:7:8)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint as runMain
at internal/main/run_main_module.js:17:47
(Use node --trace-warnings ... to show where the warning was created)
(node:172) UnhandledPromiseRejectionWarning: Unhandled promise rejection
 npm start

 npm start

[email protected] start /home/runner/IncompatibleBurdensomeLegacysystem
bash main.sh

/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/bindings/bindings.js:121
throw e;
^

Error: The module '/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/gl/build/Release/webgl.node'
was compiled against a different Node.js version using
 npm start

[email protected] start /home/runner/IncompatibleBurdensomeLegacysystem
bash main.sh

/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/bindings/bindings.js:121
throw e;
^

Error: The module '/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/gl/build/Release/webgl.node'
was compiled against a different Node.js version using
 npm start

[email protected] start /home/runner/IncompatibleBurdensomeLegacysystem
bash main.sh

/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/discord.js/src/client/websocket/WebSocketManager.js:123
const invalidToken = new Error(WSCodes[4004]);
^
 npm start

 npm start

[email protected] start /home/runner/IncompatibleBurdensomeLegacysystem
bash main.sh

/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/bindings/bindings.js:121
throw e;
^

Error: The module '/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/gl/build/Release/webgl.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at bindings (/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/home/runner/IncompatibleBurdensomeLegacysystem/node_modules/gl/src/javascript/native-gl.js:1:40)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'ERR_DLOPEN_FAILED'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: bash main.sh
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-08-25T22_34_43_782Z-debug.log
exit status 1

This is a new error...