vue前端项目安装axios失败,以及安装vue-axiox,笔记

记录一下错误解决方法。
安装axios的时候报错:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

这个是因为sass安装时获取源的问题,先修改sass安装的源
解决方法:

npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass

然后再执行命令安装axios

npm install axios --save

然后执行

npm run dev

又报错

 ERROR  Failed to compile with 1 errors                                                                         16:55:52

This dependency was not found:

* vue-axios in ./src/main.js

To install it, you can run: npm install --save vue-axios

说没有找到vue-axios
安装 vue-axios
执行命令

npm install --save vue-axios

最后执行命令,运行成功

npm run dev

你可能感兴趣的:(axios,node-sass,vue)