Angular6应用程序无法在IE上运行,但可以在其他浏览器上正常运行。 SCRIPT1002:语法错误vendor.js(69467,1922)

时间:2018-10-04 09:40:00

标签: angular

SCRIPT1002:语法错误 vendor.js(69467,1922)

当我在IE浏览器上运行我的应用程序时,它什么也没有显示并给出上述错误。 有帮助吗?

{{3}}

这是我的棱角版本

+-- @angular-devkit/build-angular@0.6.8
| +-- html-webpack-plugin@3.2.0
| | `-- pretty-error@2.1.1
| |   `-- renderkid@2.0.1
| |     `-- strip-ansi@3.0.1
| |       `-- ansi-regex@2.1.1  deduped
| `-- node-sass@4.9.0
|   +-- chalk@1.1.3
|   | `-- strip-ansi@3.0.1
|   |   `-- ansi-regex@2.1.1  deduped
|   +-- npmlog@4.1.2
|   | `-- gauge@2.7.4
|   |   +-- string-width@1.0.2
|   |   | `-- strip-ansi@3.0.1
|   |   |   `-- ansi-regex@2.1.1  deduped
|   |   `-- strip-ansi@3.0.1
|   |     `-- ansi-regex@2.1.1  deduped
|   `-- sass-graph@2.2.4
|     `-- yargs@7.1.0
|       `-- cliui@3.2.0
|         `-- strip-ansi@3.0.1
|           `-- ansi-regex@2.1.1  deduped
+-- @angular/compiler-cli@6.0.6
| `-- chokidar@1.7.0
|   `-- UNMET OPTIONAL DEPENDENCY fsevents@1.2.4
|     `-- UNMET OPTIONAL DEPENDENCY node-pre-gyp@0.10.0
|       `-- UNMET OPTIONAL DEPENDENCY npmlog@4.1.2
|         `-- UNMET OPTIONAL DEPENDENCY gauge@2.7.4
|           `-- UNMET DEPENDENCY strip-ansi@3.0.1
|             `-- UNMET DEPENDENCY ansi-regex@2.1.1
+-- ansi-regex@2.1.1
+-- protractor@5.3.2
| `-- chalk@1.1.3
|   +-- has-ansi@2.0.0
|   | `-- ansi-regex@2.1.1  deduped
|   `-- strip-ansi@3.0.1
|     `-- ansi-regex@2.1.1  deduped
+-- strip-ansi@3.0.1
| `-- ansi-regex@2.1.1  deduped
+-- tslint@5.9.1
| `-- babel-code-frame@6.26.0
|   `-- chalk@1.1.3
|     `-- strip-ansi@3.0.1
|       `-- ansi-regex@2.1.1  deduped
`-- webpack-dev-server@3.1.9
  +-- strip-ansi@3.0.1
  | `-- ansi-regex@2.1.1
  `-- yargs@12.0.2
    +-- cliui@4.1.0
    | +-- strip-ansi@4.0.0
    | | `-- ansi-regex@3.0.0
    | `-- wrap-ansi@2.1.0
    |   `-- strip-ansi@3.0.1
    |     `-- ansi-regex@2.1.1  deduped
    `-- string-width@2.1.1
      `-- strip-ansi@4.0.0
        `-- ansi-regex@3.0.0  deduped

npm ERR! missing: strip-ansi@3.0.1, required by gauge@2.7.4
npm ERR! missing: ansi-regex@2.1.1, required by strip-ansi@3.0.1

1 个答案:

答案 0 :(得分:1)

您需要包括一些用于Internet Explorer的兼容性JS文件。查看official guide

项目中还有一个polyfills.ts文件,将其检出并取消注释您的需要:

... uncomment from here
/** 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';
...

此外,如果您要开发的是企业环境,则可能还需要关闭Internet Explorer的默认兼容模式,您可以在this question

中了解更多信息。