I was creating a discord music bot in NodeJS, with discord.js as well, but whenever I run it, I get this error: (the file is not named module.js)
module.js:549
throw err;
^
Error: Cannot find module 'ytdl-core'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module.__load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Matthew\Desktop\discord bot\bot.js:2:12)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
At first, I thought it was because I needed to npm install the module like I did with discord.js, but instead I got the same error.
You require but don't install ytdl-core.
Please install it with command :
npm install ytdl-core
or install with yarn:
yarn add ytdl-core
As you mentioned that you have already done npm install ytdl-core and still you got an error.
Please make sure ytdl-core is installed.
Log suggests that bot.js require ytdl-core. So, please make sure that you have
var ytdlCore = require("ytdl-core");
May this help you. Or please add more code so I can distinguish error.
Related
I just install node.js to my system. My node version is v8.10.0. When I try npm -v I get following error.
module.js:549
throw err;
^
Error: Cannot find module 'ini'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\ai8\AppData\Roaming\npm\node_modules\npm\node_modules\config-chain\index.js:4:11)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
How can I fix this issue?
I had a same kind of issue before. I tried all the solutions even tried uninstalling and reinstalling node js. Finally, I tried by removing the node_modules from the user folder.
Then, run npm install.
This worked for me.
Hope it works for you
delete node_modules and reinstall
rm -rf node_modules
npm install
Use this link for further details. Hope this will help you.
npm
Not really good with this JavaScript world. Trying to install npm and I think it's broken. I'm using Debian and ran:
apt install npm.
Everything went fine but when I run npm it throws up this error
module.js:538
throw err;
^
Error: Cannot find module 'node-uuid'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/nodejs/request/index.js:29:12)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
Nothing works, i can't install the node-uuid either.
I fixed this, I think there's a problem with the package on Debian repo.
I followed the instruction on Node website
https://nodejs.org/en/download/package-manager/
I have npm installed now :)
After cloning my test site from github and succeeding to remove the default version of node on my raspberry pi 3 and installing V8.5.0, I ran npm install and npm install nodemon -g. Now however I am unable to run my script due to an error:
module.js:529
throw err;
^
Error: Cannot find module './lib/oauth'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (/home/pi/Projects/EncodedB0t/node_modules/request/request.js:28:13)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
I've tried adding npm install oauth --save to no avail and haven't been able to find an answer online.
Any help would be appreciated!
Edit: added my github repo, https://github.com/TheWalkingM3m3/EncodedB0t
Try run npm install request --save. Then rename oauth.js.example in your root directory on oauth.js. It's works in my case.
I am installing the the library found from MIT students using TUIO. According to their instructions I was supposed to start the server but I got an error.
Does anyone know how to fix this error?
C:\Users\PC\Desktop\server1.1>node examples/server.js
info - socket.io started
module.js:442
throw err;
^
Error: Cannot find module './build/Debug/buffertools.node'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\PC\Desktop\server1.1\node_modules\buffertool
s\buffertools.js:26:20)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
I tried following there steps and got my server stared.
I think you are missing npm i after cloning repo.
please do npm i and try starting server
You need to install the dependency packages before you can run your project.
npm install looks for the packages listed in the package.json file and installs them with their dependencies recursively.
If you are getting specific error in installation of particular package, it could be internet issue/os issue and most probably node and npm version issue. Make sure you are using a stable version of node, its version no should be even.
Im attempting to get Push notifications working with Android. Im following the tutorial here. It require installation of the node-gcm module of node.js. I installed this with the following command:
sudo npm install -g node-gcm
I have a file called notify.js. I run this with:
node notify.js
But I'm always getting the error:
module.js:333
throw err;
^
Error: Cannot find module 'node-gcm'
at Function.Module._resolveFilename (module.js:331:15)
at Function.Module._load (module.js:273:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object.<anonymous> (/var/www/PushPlay/notify.js:1:73)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:349:32)
at Function.Module._load (module.js:305:12)
at Function.Module.runMain (module.js:490:10)
Any ideas?
If you've done a global install of the module, sometimes you need to create a symlink to the global module. Try npm link node-gcm.
Also try and install node-gcm without the global switch (npm install node-gcm), if it works locally you'll know it's an issue with the global install.