Subscribe on changes!

The error I got after deployment(部署后得到的错误) "TypeError: i.then is not a function"

avatar
Oct 10th 2021

Version

3.2.8

Reproduction link

imooc-admin.lgdsunday.club/

Steps to reproduce

  1. Go to https://imooc-admin.lgdsunday.club/ link
  2. Log in
  3. Then the console will throw "TypeError: i.then is not a function"

  1. 进入 https://imooc-admin.lgdsunday.club/ 链接
  2. 进行登录
  3. 之后控制台会抛出 《TypeError: i.then is not a function》

What is expected?

Can enter normally


可以正常进入

What is actually happening?

TypeError: i.then is not a function


This is an unexpected error. I can perform login follow-up operations normally during development, but once deployed, I will get a "TypeError: i.then is not a function" error. I intercepted the corresponding part of the code, only knowing that the exception was thrown in the following code, but I don't know the reason?


这是一个意料之外的错误。 我在开发时可以正常进行登录后续操作,但是一旦部署将会得到一个《TypeError: i.then is not a function》的错误。 我截取对应的代码部分,只能知道是在下列代码中抛出了异常,但是却不知道原因是什么?


      function Re(e, t, n, o) {
        const r = []
        for (const a of e)
          for (const e in a.components) {
            let l = a.components[e]
            if ('beforeRouteEnter' === t || a.instances[e])
              if ($e(l)) {
                const i = l.__vccOpts || l,
                  c = i[t]
                c && r.push(ze(c, n, o, a, e))
              } else {
                let i = l()
                0,
                  r.push(() =>
                    i.then((r) => {
                      if (!r)
                        return Promise.reject(
                          new Error(`Couldn't resolve component "${e}" at "${a.path}"`)
                        )
                      const l = p(r) ? r.default : r
                      a.components[e] = l
                      const i = l.__vccOpts || l,
                        c = i[t]
                      return c && ze(c, n, o, a, e)()
                    })
                  )
              }
          }
        return r
      }
avatar
Oct 10th 2021

你需要提供一个最小可以复现的demo,否则是没办法帮你解决问题的。

像是vue-router-next的问题。注意看开发环境是否有警告。 image

avatar
Oct 11th 2021

多谢,我当时忽略了警告

avatar
Jul 4th 2023

怎么修复的