我正在尝试在代码中使用axios
,
import axios from 'axios';
axios.get("http://someurl.com")
.then(response => {
console.log(response)
})
.catch(error => {
console.log("Error parsing data", error);
});
这将引发以下错误:
import axios from 'axios';
^^^^^
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:743:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
at internal/main/run_main_module.js:21:11
我在这里做什么错了?