【问题标题】:New Angular CLI project fails on Internet Explorer新的 Angular CLI 项目在 Internet Explorer 上失败
【发布时间】:2017-11-22 04:07:52
【问题描述】:

截至今天早上,当我使用 Angular CLI 创建一个新项目时,它会在 IE11 上引发异常并返回此错误消息(在控制台中)。

SCRIPT5007: Unable to get property 'call' of undefined or null reference
File: inline.bundle.js, Line: 55, Column: 12

昨天它正常工作。

我正在使用

Angular CLI:1.5.3
节点:6.9.5
操作系统:win32 x64
角度:5.0.2

这些是我创建项目所遵循的步骤

ng new tempProject
cd tempProject\
npm install --save classlist.js
npm install --save web-animations-js

然后我编辑 polyfill.ts 文件并取消注释除“intl”之外的所有内容。之后我使用 'ng serve' 并尝试在 IE 中加载它。我什至删除了 node_modules 目录并使用 npm install 重新创建它。当然,它在 chrome 上运行良好。但我需要让它在 IE11 上运行,因为它是我工作的公司标准。

每个 github 问题都会讨论 polyfill 文件。但是除非我应该添加一些我不知道的东西,否则这对我没有帮助。有人有什么想法吗?

【问题讨论】:

  • 那么inline.bundle.js 的第 55 行第 12 列周围是什么?另外,当您查看错误的堆栈跟踪时,这是否有助于您找到错误的原因?
  • 您可以在 plunker 或任何其他在线工具上设置您的项目吗?
  • 只需读取项目中文件“src/polyfills.ts”中的 cmets。你会明白的。

标签: javascript angular


【解决方案1】:

原来这只是 Internet Explorer 忘记了如何运行 javascript 什么的。一旦我关闭 IE,等待它真正关闭(观看任务管理器肯定会看到),然后再次启动它,它工作正常。

【讨论】:

  • 是的。这让我很困惑,因为它发生在我随机更改一行文本之后,我正试图弄清楚到底是怎么弄坏了一些东西。
【解决方案2】:

请检查您的 polyfills.js 文件并取消注释下面的代码行,然后重试。

同时更新 tsconfig.json 中的目标:"target": "es5"

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js';  // Run `npm install --save classlist.js`.

/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-07
    • 2019-05-06
    • 2019-08-02
    • 1970-01-01
    • 2012-05-26
    • 1970-01-01
    • 1970-01-01
    • 2011-12-17
    相关资源
    最近更新 更多