angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Ng Serve fails at 95% - TypeError: callbacks[i] is not a function

Open DanielStep opened this issue 8 years ago • 184 comments

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

DanielStep avatar Feb 08 '18 11:02 DanielStep

@amithole1987 "typescript": "^2.5.3", "@angular/cli": "^1.6.0", "@angular/compiler-cli": "^4.4.5",

maicongobbi avatar Feb 08 '18 15:02 maicongobbi

it seems to work now!

yinonov avatar Feb 08 '18 15:02 yinonov

Now arrived v4.4.1 💃 https://www.npmjs.com/package/copy-webpack-plugin Now it hasn't this bug!

fehernyul avatar Feb 08 '18 15:02 fehernyul

$ npm install [email protected] This command worked for me..

TsongSteven avatar Feb 08 '18 15:02 TsongSteven

Hi all,

[email protected] was just released with a fix that addresses this problem (https://github.com/webpack-contrib/copy-webpack-plugin/pull/221).

A big thanks to the Webpack folks, especially @evilebottnawi, for looking investigating this problem and releasing a new version so quickly.

Using npm, follow these steps to force update:

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.

I am going to close this topic for now so that my answer will be the most visible for anyone experiencing this issue.

I'm sorry to remove your ability to comment on it but for new users it would be very hard to find the solution with so many comments coming up. I will reopen in a few hours.

filipesilva avatar Feb 08 '18 15:02 filipesilva

New release!! from copy-webpack-plugin https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v4.4.1 Fixed!

JcOnSoftware avatar Feb 08 '18 15:02 JcOnSoftware

Leaving issue opened for now to increase visibility, but will close later when reopening comments. For any new users coming into this issue, please check my comment just above regarding the resolution.

filipesilva avatar Feb 08 '18 15:02 filipesilva

the only way to resolve this issue is to use a previous version of the @angular/cli. Which is version 1.6.1 and before

darrell-parkhouse5151 avatar Feb 08 '18 19:02 darrell-parkhouse5151

I have only been able to solve this as well by reverting version of @angular/cli to 1.60 or 1.6.1. I have this issue for more clarity but relates to the topic here: TypeError: fromJSON_1.default is not a function

slashinski avatar Feb 08 '18 19:02 slashinski

Uninstall and reinstall angular cli again. Issue is already solved

yinonov avatar Feb 08 '18 19:02 yinonov

This has been solved by a new release of the copy webpack plugin.

hansl avatar Feb 08 '18 20:02 hansl

With me, works only after reinstalling @angular/cli and, in addition, delete package-lock.json, remove node_modules and reinstall packages

gilbertogwa avatar Feb 09 '18 00:02 gilbertogwa

deleting package-lock.json and npm install [email protected] worked for us. Cheers!!!

kedar9444 avatar Feb 09 '18 04:02 kedar9444

So, I was facing the same problem. What I did

npm uninstall -g @angular/cli
npm cache clean --force
npm install -g @angular/cli

It is working now. Cheers

adnanrafique avatar Feb 09 '18 05:02 adnanrafique

I made downgrade compiler-cli up to 5.2.3 and I started

mazulatas avatar Feb 09 '18 06:02 mazulatas

After updating and trying build version still got this error obraz

dandro32 avatar Feb 09 '18 07:02 dandro32

npm install [email protected] --save

Its Working For Me ..Thanks :)

sathhya avatar Feb 09 '18 08:02 sathhya

Hi team, have you planned a patch in the angular-cli in order to fix this issue? thank you in advance.

albertnadal avatar Feb 09 '18 09:02 albertnadal

@albertnadal a patch isn't required to fix this issue as it was to do with a dependency which has now fixed, npm install / clearing npm cache then installing should fix the issue

danny95djb avatar Feb 09 '18 12:02 danny95djb

npm install [email protected] Work for Me there are my configuration

Angular CLI: 1.6.8 Node: 8.9.4 OS: win32 x64 Angular: 5.2.1 ... 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

Thank's

wilfried11 avatar Feb 09 '18 17:02 wilfried11