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

SyntaxError: Unexpected token import, when import axios #54

Open
Mcgrean0519 opened this issue Nov 12, 2024 · 0 comments
Open

SyntaxError: Unexpected token import, when import axios #54

Mcgrean0519 opened this issue Nov 12, 2024 · 0 comments

Comments

@Mcgrean0519
Copy link

As I used 'const axios = require('axios');' in my javascript file.
When I build my Android application, the following error appeared.
/data/data/com.yourorg.sample/files/nodejs-project/node_modules/axios/index.js:1
(function (exports, require, module, __filename, __dirname) { import axios from './lib/axios.js';
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:588:28)
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)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (/data/data/com.yourorg.sample/files/nodejs-project/demo.mjs:1:77)
But I had updated my node version and installed the axios by npm.
I really need to use axios library.
Does anyone know the reason? How can i fix it?

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

1 participant