Glitch is keeping to change my index.js file for my discord bot


#1

Hello,

I want to host my discord bot on glitch.
But the console keeps sending me an error, but that error isn’t there.
The error says always that i have a type fault. But when i change that. The same error comes up again.
So I tried to refresh the page and change the fault but that doesn’t help. It always says the same error, over and over again. When i change it to what it needs to be it is still giving that error. Then if I refresh the page it has changed my index.js file to what the error said. It keeps going on and on.

Does somebody now how i can fix this?

Thanks in advance.


#2

Thanks for reporting. It would be helpful if you could let us know the specific message of the error you’re seeing and the name of your project. If your project is private, then either make it public or DM me a join link so I can take a look. Thanks.


#3

Hello,

Thanks for your quick respond.

How can I send you the link in DM because I just started out using glitch. Oh and this is the error:

let xp = require(json")jrange);

                 ^^^^^^^^^^

SyntaxError: Invalid or unexpected token

at new Script (vm.js:51:7)

at createScript (vm.js:136:10)

at Object.runInThisContext (vm.js:197:10)

at Module._compile (internal/modules/cjs/loader.js:618:28)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)

at Module.load (internal/modules/cjs/loader.js:566:32)

at tryModuleLoad (internal/modules/cjs/loader.js:506:12)

at Function.Module._load (internal/modules/cjs/loader.js:498:3)

at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)

at startup (internal/bootstrap/node.js:201:19)

#4

You can email it- gwilson@fogcreek.com. Thanks.


#5

That require statement is broken. It should look like this, but I can’t tell exactly what library you’re trying to use:

let xp = require(“library-name-here”);


#6

Yes i know.

It was first let xp = require("./xp.json"); but glitch changes it al the time.


#7

It looks like you had a lone 0x0d character in your file somehow, and that confused the editor. I deleted that character, and now I seem to be able to edit your index.js without the problem showing up.


#8

thanks i tried it now again but now the error is popping up in my errors.js file. I hope it is not the same problem again.


#9

It turns out that wasn’t the whole story. It looks like your files were in Windows format, so their line endings were wrong, which confuses our editor. You can run dos2unix <filename> in the console to fix a file.

I did this for all of your files, and things seem to be working. I’ll also fix this problem so that they get converted automatically in the future.


#10

Hello,

Thanks for your help. I hope it works now.


#11

This is now fixed in the server, so you shouldn’t see it again.