尝试使用axios
库时,你的项目构建遇到了问题,详细报错内容如下:
Failed to compile.
./node_modules/axios/lib/platform/index.js Module parse failed: Unexpected token (5:2) You may need an appropriate loader to handle this file type. | | export default { | ...utils, | ...platform | } @ ./node_modules/axios/lib/defaults/index.js 8:0-44 @ ./node_modules/axios/lib/axios.js @ ./node_modules/axios/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?
http://localhost:8080
webpack/hot/dev-server ./src/main.js
我更换了一下axios的版本,把1.6.8换成了1.4.0:
npm install axios@1.4.0 --save
再次点击运行,项目就可以跑了~
P.S. axios当前版本号可以去package.json里面找,附图如下: