Node - Won't install library

cain

insert html
May 12, 2012
180
74
GnPYbfP.png

I don't really use Node, so no idea, trying to install discord.io and isn't installing, it has in the past not sure what's wrong now.

Any ideas?
 

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
GnPYbfP.png

I don't really use Node, so no idea, trying to install discord.io and isn't installing, it has in the past not sure what's wrong now.

Any ideas?
I just just started messing with node so pardon me if i sound noob.

But, if you're installing the package onto your whole pc you'll wanna use npm install -g <package> (-g means global), and if you're only installing it onto one of your projects you can use npm install --save <package> and it places it in node_modules folder of your current directory.

as for the warnings about the desc and license and readme, you can ignore those. it's just letting you know that you left some fields empty in your package.json

also, to launch some packages sometimes it's as easy as npm start discord.io, but idk in your case
 

cain

insert html
May 12, 2012
180
74
I just just started messing with node so pardon me if i sound noob.

But, if you're installing the package onto your whole pc you'll wanna use npm install -g <package> (-g means global), and if you're only installing it onto one of your projects you can use npm install --save <package> and it places it in node_modules folder of your current directory.

as for the warnings about the desc and license and readme, you can ignore those. it's just letting you know that you left some fields empty in your package.json

also, to launch some packages sometimes it's as easy as npm start discord.io, but idk in your case

Thanks a lot! This helped a ton, it's installed now.

However, when trying to run the bot.js file it gives me an error which it says resides on Line 1 which is
Code:
var Discord = require('discord.io');

I'm guessing this is suggesting it hasn't properly installed or installed at all?
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
Thanks a lot! This helped a ton, it's installed now.

However, when trying to run the bot.js file it gives me an error which it says resides on Line 1 which is
Code:
var Discord = require('discord.io');

I'm guessing this is suggesting it hasn't properly installed or installed at all?
Yeah probably why. You should look for installing errors when downloading a module. And btw, you can just use instead of var and you don't have to use semicolons in that particular example because of ASI in ES5
 

cain

insert html
May 12, 2012
180
74
Yeah probably why. You should look for installing errors when downloading a module. And btw, you can just use instead of var and you don't have to use semicolons in that particular example because of ASI in ES5

Yeah, I've looked deeper and found out the modules aren't saving to the nodejs folder in the program files directory but elsewhere, this could possibly be the problem right? I deleted the folder in the wrong directory and ran npm install -g discord.io winston & it re-creates the folder in the wrong place, I've also moved the modules to the right directory but has no effect, any ideas?

I also touched up the code, thank you for the tip :p
 

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
Yeah, I've looked deeper and found out the modules aren't saving to the nodejs folder in the program files directory but elsewhere, this could possibly be the problem right? I deleted the folder in the wrong directory and ran npm install -g discord.io winston & it re-creates the folder in the wrong place, I've also moved the modules to the right directory but has no effect, any ideas?

I also touched up the code, thank you for the tip :p


cd <directory where bot.js is>
npm init
<enter> xwhatever
"entry point": bot.js
*package.json generated*
npm install --save discord.io

node bot.js
it should then run, using the package saved to node_modules
 

cain

insert html
May 12, 2012
180
74
cd <directory where bot.js is>
npm init
<enter> xwhatever
"entry point": bot.js
*package.json generated*
npm install --save discord.io

node bot.js
it should then run, using the package saved to node_modules
Forgot to reply, thanks a lot for your help really appreciated.

Also you might want to use nodemon, so you don't need to retype node bot.js all over again.
Will bare this in mind, thank you.
 

Users who are viewing this thread

Top