Discord.js bot broke - discord.js

I read something about this error, but I have discord.js 13.6.0 and node 17.x.x
and I don't know what can couse it.
error:
Error: Cannot find module 'node:events'
Require stack:
- /home/runner/FittingAttachedHacks/node_modules/discord.js/src/client/BaseClient.js
- /home/runner/FittingAttachedHacks/node_modules/discord.js/src/index.js
- /home/runner/FittingAttachedHacks/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous>
(/home/runner/FittingAttachedHacks/node_modules/discord.js/src/client/BaseClient.js:3:22)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)

looks like you have installed link, but not the actual node version v17. Try uninstalling wrong package v17.4.0 and install the right version from official site of node.js

The required node version for discord js v13 is node verson of v16 or higher, without it you'll get error like:
1.AbortController is not defined
2.Unexpected token '?'
3.cannot find module 'node:events'
The simple solution is just upgrade to node v16 and the error will be fixed!

Download Node from the website or NVM (Node Version Manager) if you're using Linux.
NVM link: https://github.com/nvm-sh/nvm

Related

run Angularjs application fails

i try to run an angularjs applic, i understood that max version of node that can run it is 6.17.1
so i downloaded it using nvm, and then i run npm install but when i run npm start it failse and it looks like it downloade dependencis of higher versions that use es6 so thats why it fails.
i tried to downgrade specific libraries by deleting them from node modules and installing again specific lower version but when i tried npm show version it looks like its still use the higher version.
the error message is:
Failed to load external module #babel/register
[08:42:09] Requiring external module babel-register
C:\Users\s313240798\source\Workspaces\Nesher\Nesher\Nesher.Client\node_modules\micromatch\index.js:44
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Module._extensions..js (module.js:586:10)
at Object.require.extensions.(anonymous function) [as .js] (C:\Users\s313240798\source\Workspaces\Nesher\Nesher\Nesher.Client\node_modules\babel-register\lib\node.js:152:7)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
i tried to run it also with higher version of node but then the app was on but faild because of th e Incompatibility of versions
This page has some suggestions which may help fix your issue: github.com/gulpjs/gulp/issues/1631
Have you tried this suggestion from the above web page?
npm i -S babel-register

create-react-app not working due to postcss

I am currently learning react, and started a new app with create-react-app.
I navigated into the new app, then ran npm start.
I got this error message:
Error: Cannot find module '~/Desktop/forms-test/node_modules/postcss-safe-parser/node_modules/postcss/lib/tokenize'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:907:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:900:15)
at resolveExports (internal/modules/cjs/loader.js:432:14)
at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (~/Desktop/forms-test/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
Any help would be very useful.
I am running Mac OS Catalina, using npm, and running zsh. I am using node version 14.13.1
For others digging around, I followed the instructions on this answer.
rm yarn.lock
yarn install
And that reinstalled everything and properly exported the lib/tokenize path inside of node_modules/postcss-safe-parser/node_modules/postcss/package.json.

ReactNative: Trying to debbug cannot find module

I'm trying to debug my app. In the past everything worked perfectly. Then I formatted the computer, downloaded the project I had saved from git.
At this point, every time I try to run npm start in the terminal or to use the react native tool of visual studio code to debug the app or in any case to update the app connected to my device I get this error:
Error: Cannot find module '/Users/..../node_modules/#react-native-community/cli/build/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:338:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:719:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1072:27)
at Function.Module._load (internal/modules/cjs/loader.js:928:27)
at Module.require (internal/modules/cjs/loader.js:1145:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/Users/.../node_modules/react-native/cli.js:12:11)
at Module._compile (internal/modules/cjs/loader.js:1256:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Module.load (internal/modules/cjs/loader.js:1105:32) {
code: 'MODULE_NOT_FOUND',
path: '/Users/..../node_modules/#react-native-community/cli/package.json',
requestPath: '#react-native-community/cli'
I don't understand how can I do.
I remember that before when I made a change to the code I just needed to run npm start to reload my project and see the changes in my device. Now I absolutely can't get the code and device to interact.
How can I do?
You try reinstall React LI:
npm install –g react-native-cli
and install dependences:
npm install

Error while running jest on node 0.12.0

I'm trying to run Jest test in my project and I have node v0.12.0 , so running the Jest test gives me the error below:
/Users/ajaybeniwal203/ODeskWork/ui-components/node_modules/jest-cli/node_modules/harmonize/harmonize.js:31
node.stdout.pipe(process.stdout);
TypeError: Cannot read property 'pipe' of undefined
at module.exports (/Users/ajaybeniwal203/ODeskWork/ui-components/node_modules/jest-cli/node_modules/harmonize/harmonize.js:31:20)
at Object.<anonymous> (/Users/ajaybeniwal203/ODeskWork/ui-components/node_modules/jest-cli/bin/jest.js:39:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3 npm ERR! Test failed.
See above for more details.
How do I resolve this?
It is known issue:
It's known and has to do with JSDOM + contextify mostly.
Try using node 0.10 instead, nvm or similar alternatives available for windows should help.
Cool Question. This is due to Jest does NOT support Node v0.12
Unfortunately, there is NO way to resolve this so far (jest v0.4.x); however, here is workaround: Use v0.10
Try to use nvm to switch node version for your development env:
Switch to previous version
nvm use 0.10
Rebuild dependencies
npm rebuild
Run tests on previous version
npm test
FYI, if you use Node, the next version of Jest (v0.5) will NOT support; if you use io.js, it's all good to continue.
I have using Jest since v0.1 and sorry to say that I have 0 confidence on it anymore. I will switch to Mocha then.
HTH

Integrating Karma and webstorm

I would like to integrate Karma and webstorm for windows, I have followed the steps from this web:
http://mobicon.tistory.com/273 (translate it to english) but does not work.
I have created one Karma Server and a Karma run:
In Path to Node Js File textfield, I have pointed to a karma file from the node-modules:
C:\Users\xxx\AppData\Roaming\npm-cache\karma\0.8.4\package\bin\karma
In the application parameters for the server start and for the Karma Run run
I get the following errors:
module.js:340
throw err;
^
Error: Cannot find module 'optimist'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (C:\Users\Javito\AppData\Roaming\npm-cache\karma\0.8.4\package\lib\cli.js:2:16)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
Process finished with exit code 1
The problem was the Karma execution file (Path to node App JS file) I was pointing to, here is my configuration for both server and run:
Karma Server:
Karma Run:
Trying to run sails app(app.js nodejs) in Webstorm gave me the optimist error in Ubuntu 14(32 bits). I fixed it by running:
sudo npm install optimist
Cheers!

Resources