gpt4 book ai didi

javascript - 带有 promise.prototype.finally 的 Axios 不起作用

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:13:20 24 4
gpt4 key购买 nike

不确定我错过了什么。按照此处的说明进行操作:https://github.com/mzabriskie/axios/blob/master/COOKBOOK.md

我已经 npm 安装了 axios 和 npm install axios promise.prototype.finally --save

我正在使用 Gulp 和 Browserify。

var axios = require('axios');
require('promise.prototype.finally');

axios.get('http://google.com').finally(function(){
console.log('test');
});

错误:

app-7ee90adab7.js:18780 Uncaught TypeError: axios.get(...).finally is not a function

更新:这使其有效,但我需要这样做吗?

var promiseFinally = require('promise.prototype.finally');
promiseFinally.shim();

最佳答案

关于javascript - 带有 promise.prototype.finally 的 Axios 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39696007/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com