Angular CLI给我“TypeError:callbacks [i]不是函数”当我“服务”时 [英] Angular CLI gives me "TypeError: callbacks[i] is not a function" when I "ng serve"

查看:245
本文介绍了Angular CLI给我“TypeError:callbacks [i]不是函数”当我“服务”时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确实刚刚安装了Angular CLI以便试用它,我不知道在命令行上导致以下错误的原因是什么:

I literally just made a fresh installation of the Angular CLI in order to try it out and I don't have a clue on what's causing the following error on the command line:

    PC:cobros Fran$ ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 95% emitting/Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40
        callbacks[i](err, result);
                    ^

TypeError: callbacks[i] is not a function
    at Storage.finished (/Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40:15)
    at /Users/Fran/Documents/Workspace/Repos/cobros/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:77:9
    at /Users/Fran/Documents/Workspace/Repos/cobros/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:153:5)

这是我在尝试ng -v时返回的信息(如果它有用的话):

This is the information I get returned when I try "ng -v" (In case it's useful at all):

Angular CLI: 1.6.8
Node: 8.9.0
OS: darwin x64
Angular: 5.2.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0

'增强解析'是什么?模块甚至呢?
我安装了角度错了吗?我按照 https://github.com/angular/angular-cli 的说明进行操作并确保我满足了先决条件。

What does the 'enhanced-resolve' module even do? Did I install angular wrong? I followed the instructions from https://github.com/angular/angular-cli and made sure I fulfilled the prerequisites.

推荐答案

编辑:问题现已修复,因此无需再使用此解决方法。

The issue is now fixed, so there is no need to use this workaround anymore.

找到解决方案(解决方法)这里

Solution (workaround) found here

添加copy-webpack-plugin: 4.3.0到你的package.json

Add "copy-webpack-plugin": "4.3.0" to your package.json

谢谢@neshkatrapati

Thanks @neshkatrapati

这篇关于Angular CLI给我“TypeError:callbacks [i]不是函数”当我“服务”时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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