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

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

问题描述

当我删除polyfills.ts中的注释部分以使Polyfill加载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`.

但是,如果我们确实使用角度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天全站免登陆