未找到 Angular4.x 模块:错误:无法解析“classlist.js" [英] Angular4.x Module not found: Error: Can't resolve 'classlist.js'

查看:44
本文介绍了未找到 Angular4.x 模块:错误:无法解析“classlist.js"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我删除 polyfills.ts 中的注释部分以便 polyfills 在 Internet Explorer 中加载页面时

When I remove comment part in polyfills.ts for polyfills to load page in Internet Explore

/** 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';
 import 'reflect-metadata';
/** 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';


/**
 * Required to support Web Animations `@angular/animation`.
 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
 **/
 import 'web-animations-js';  // Run `npm install --save web-animations-js`.

但是如果我们确实使用 angular cli 进行构建.它在控制台中引发错误我确实在项目npm install --save classlist.js"中运行了这个命令

But if we do build using angular cli. it throws error in console I did run this command in project "npm install --save classlist.js"

Module not found: Error: Can't resolve 'classlist.js' in src
 @ ./src/polyfills.ts 36:0-22
 @ multi ./src/polyfills.ts

请提出解决方案

推荐答案

删除当前包,

npm uninstall classlist.js --save

然后运行

npm cache verify

然后运行

npm install classlist.js --save-exact

这篇关于未找到 Angular4.x 模块:错误:无法解析“classlist.js"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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