Ng Serve fails at 95% - TypeError: callbacks[i] is not a function
Versions
Angular CLI: 1.6.8
Node: 9.5.0
OS: darwin x64
Angular: 5.2.4
@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
MacOS High Sierra 10.13.3
Repro steps
MacBook-Pro:~ daniel$ ng new test-proj ... Installed packages for tooling via npm. Successfully initialized git. Project 'test-proj' successfully created.
MacBook-Pro:~ daniel$ cd test-proj/
MacBook-Pro:test-proj daniel$ npm install up to date in 6.008s
MacBook-Pro:test-proj daniel$ ng serve
Observed behavior
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
95% emitting/Users/daniel/test-proj/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40
callbacks[i](err, result);
^
TypeError: callbacks[i] is not a function
at Storage.finished (/Users/daniel/test-proj/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40:15)
at /Users/daniel/test-proj/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:77:9
at /Users/daniel/test-proj/node_modules/graceful-fs/polyfills.js:287:18
at FSReqWrap.oncomplete (fs.js:167:5)
Desired behavior
For build to be 100% successful and served to browser
[email protected] didn't help
clean project with ng new, all latest angular stuff, wont work either
Same issue. I tested "npm install [email protected]" and it works for me. (localhost project)
also ng test --code-coverage --single-run doesn't work anymore
TypeError: Cannot read property 'apply' of undefined
lets go have a drink then come back :)
Thanks @danielszenasi ! That worked for me. :)
For anybody using Gitlab with yarn, you'll need to add a script line after "yarn install":
- npm install [email protected]
This fixed it for me
Hi all,
@evilebottnawi is looking into this from the webpack side, and I am looking at it from the CLI side.
It seems to be a bad interaction in usage of the webpack file system. I don't yet have more details than that but we are looking into this.
There's already a couple of suggestions on how to work around for now but I will reiterate for visibility: you can try to force install [email protected] in your project.
Using npm, follow these steps:
npm ls copy-webpack-pluginshould show[email protected]installednpm install [email protected]npm uninstall [email protected]installing and uninstalling should force the npm to resolve and dedupe to4.3.1npm ls copy-webpack-pluginshould show[email protected]installed
I used npm 5.6.0 for this, and recommend you use at least that version as well since it has lockfile support and solves some npm problems with windows.
@kylecordes has also offered some advice for Yarn users in https://github.com/angular/angular-cli/issues/9550#issuecomment-364110779.
I'd like to remind everyone that you only have reproducible installs if you use a lockfile. Both NPM v5+ and Yarn support lockfiles. If your CI works one day but not the next and you did not change your code or package.json, it is likely because one of your dependencies had a bad release and you did not have a lockfile.
It is your responsibility as a library consumer to use lockfiles. No one wants to do a release with bugs but it sometimes happens, and the best we can do is to fix it as fast as possible with a new release. When you have a couple of thousand total dependencies it is only a matter of time until one of them has a bad release.
Same Here!
Same problem.... version 1.6.7
@gamebenchjake 's solution worked for me. I found the answer here https://stackoverflow.com/questions/48684276/angular-cli-gives-me-typeerror-callbacksi-is-not-a-function-when-i-ng-serv
npm install --save [email protected] Worked for us.
We are running Visual Studio Builds for Angular App. This is out setup:

Can anyone direct me to a resource that details implementing this fix on an Azure web app through VSTS?
Worked for me npm install [email protected] --save
npm install [email protected] solve my issue
I had the same problem, but the solution npm install [email protected] worked for me.
thanks @danielszenasi
SAME ERROR HERE
Angular CLI: 1.6.7 Node: 6.9.4 OS: win32 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.7 angular-devkit/build-optimizer: 0.0.42 angular-devkit/core: 0.2.0 angular-devkit/schematics: 0.0.52 ngtools/json-schema: 1.1.0 ngtools/webpack: 1.9.7 schematics/angular: 0.1.17 typescript: 2.5.3 webpack: 3.10.0
Me too
npm install package@version still adds semver ranges and didn't help in my case, so I used -E option to use an exact version. Additionally using option -O to add the plugin to peer dependencies only, as the webapp doesn't depend directly on copy-webpack-plugin. Solution described here: https://stackoverflow.com/a/48687139/3120193