Unexpected Token.. Error Occurred
See original GitHub issue
function launch() {
const { Authenticator, Client} = require("minecraft-launcher-core");
const launcher = new Client();
const user = document.getElementById('username')
const pass = document.getElementById('password')
let opts = {
overrides: {
gameDirectory: "", // where the game process generates folders like saves and resource packs.
minecraftJar: "",
versionJson: "",
directory: "", // where the Minecraft jar and version json are located.
natives: "", // native directory path.
assetRoot: "",
libraryRoot: "",
cwd: "", // working directory of the java process.
detached: true, // whether or not the client is detached from the parent / launcher.
classes: [], // all class paths are required if you use this.
minArgs: 11, // The amount of launch arguments specified in the version file before it adds the default again
maxSockets: 2, // max sockets for downloadAsync.
// The following is for launcher developers located in countries that have the Minecraft and Forge resource servers
// blocked for what ever reason. They obviously need to mirror the formatting of the original JSONs / file structures.
url: {
meta: "https://launchermeta.mojang.com", // List of versions.
resource: "https://resources.download.minecraft.net", // Minecraft resources.
mavenForge: "http://files.minecraftforge.net/maven/", // Forge resources.
defaultRepoForge: "https://libraries.minecraft.net/", // for Forge only, you need to redefine the library url
// in the version json.
fallbackMaven: "https://search.maven.org/remotecontent?filepath="
}
}
}
launcher.launch(opts)
launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e));
}
This IS My Code Down Is The Error Code
Uncaught SyntaxError: Unexpected token ...
at createScript (vm.js:74)
at Object.runInThisContext (vm.js:116)
at Module._compile (module.js:533)
at Object.Module._extensions..js (module.js:580)
at Module.load (module.js:503)
at tryModuleLoad (module.js:466)
at Function.Module._load (module.js:458)
at Module.require (module.js:513)
at require (internal/module.js:11)
at Object.<anonymous> (C:\Users\Nishant\Downloads\Electron App\node_modules\minecraft-launcher-core\index.js:2)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (5 by maintainers)
Top Results From Across the Web
SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >SyntaxError: Unexpected token in JavaScript
The "Uncaught SyntaxError: Unexpected token" error also occurs if you have a missing or extra bracket, parenthesis or comma.
Read more >How to fix JavaScript unexpected token error
In the code above, the unexpected token error happens because the plus symbol + is reserved in JavaScript for concatenation and adding two...
Read more >JavaScript Error Handling: Unexpected Token
Not follow them throws an error.An unexpected token occurs if JavaScript code has a missing or extra character { like, ) + –...
Read more >How to fix: "SyntaxError: Unexpected token" in JavaScript
One common cause of the SyntaxError: Unexpected token error is a missing semicolon. In JavaScript, semicolons are used to indicate the end of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed myself :> It Will Be Great If You Delete This Issue 😃
Adding on, don’t use overrides. Just follow the standard example.