未捕获的ReferenceError:__importDefault未定义 [英] Uncaught ReferenceError: __importDefault is not defined

查看:187
本文介绍了未捕获的ReferenceError:__importDefault未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手.我在index.component.ts文件中遇到此错误.

I am new to angular. I encounter this error in my index.component.ts file.

未捕获的ReferenceError:__importDefault未定义

Uncaught ReferenceError: __importDefault is not defined

附加了错误屏幕截图

推荐答案

从8升级到9时,我遇到了这个问题,认为这是一个错误,甚至开始在

I got this problem when upgrading from 8 to 9, thought it was a bug and even started reporting it in https://github.com/angular/angular/issues/35208, but I'm not sure it is really a bug. It might help someone having this error, though, so I'm posting here.

简短答案:

由于某些原因因为我没有运行迁移就更新了Angular CLI(由于我有一些非常特殊的约束),所以我的package.json就是这样(那些依赖项被遗忘了):

For some reason Because I updated Angular CLI without running the migrations (due to some very particular constraints I had), my package.json was like this (those dependencies were left behind):

  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.20",
    "@angular-devkit/build-ng-packagr": "~0.803.20",
    ....

将其更改为以下版本后,问题就消失了如果出现以下情况,则不会发生此问题:

After changing it to the versions below, the problem is gone The problem wouldn't happen if they were as follows:

  "devDependencies": {
    "@angular-devkit/build-angular": "~0.900.1",
    "@angular-devkit/build-ng-packagr": "~0.900.1",
    ....

请记住,此处显示的软件包版本错误/正确,因此很容易识别症状,但是不建议您手动更新它们,请运行CLI迁移(如票证中所述),正确更新.

Keep in mind that I show the wrong/right package versions here so it's easy to identify the symptoms, but I do not recommend you updating them manually, please run the CLI migration (as explained in the ticket) and they will be updated correctly.

这篇关于未捕获的ReferenceError:__importDefault未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆