Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing API?! #16

Closed
RPGFabi opened this issue Mar 16, 2020 · 1 comment
Closed

Importing API?! #16

RPGFabi opened this issue Mar 16, 2020 · 1 comment

Comments

@RPGFabi
Copy link

RPGFabi commented Mar 16, 2020

Hey,
I'm trying to import the API but getting this error:
"import clashApi from 'clash-of-clans-api';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1063:16)
at Module._compile (internal/modules/cjs/loader.js:1111:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47"

My Code is:
"client.once('ready', () => {
console.log("I'm now Ready to go!")

import clashApi from 'clash-of-clans-api';
let client = clashApi({
    token: CoCAPIToken
});
}

})"

@RPGFabi
Copy link
Author

RPGFabi commented Mar 18, 2020

const clashApi = require('clash-of-clans-api');
let CoCClient = clashApi({
token: CoCAPIToken
})

works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants