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

There may be some kind of evil hiding behind the angular's backend.

withcancer avatar Feb 08 '18 12:02 withcancer

Same problem here how to resolved it

95% emitting/home/suraj/Desktop/Untitled Folder/my-app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40 callbacks[i](err, result); ^

TypeError: callbacks[i] is not a function at Storage.finished (/home/suraj/Desktop/Untitled Folder/my-app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40:15) at /home/suraj/Desktop/Untitled Folder/my-app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:77:9 at /home/suraj/Desktop/Untitled Folder/my-app/node_modules/graceful-fs/polyfills.js:287:18 at FSReqWrap.oncomplete (fs.js:167:5)

surajjadhav720 avatar Feb 08 '18 12:02 surajjadhav720

"copy-webpack-plugin": "^4.1.1" is causing the issue. A new version of copy-webpack-plugin (4.4.0) is what broke angular cli.

danny95djb avatar Feb 08 '18 12:02 danny95djb

npm install [email protected] solved the problem

danielszenasi avatar Feb 08 '18 12:02 danielszenasi

I can confim that downgrade of copy-webpack-plugin to 4.3.1 works for me (angular 5.2.3 & 5.2.4 /cli 1.6.6 &1.6.8). Thanks, @neshkatrapati

kdcro101 avatar Feb 08 '18 12:02 kdcro101

Root issue is webpack-contrib/copy-webpack-plugin#217

tsvetomir avatar Feb 08 '18 12:02 tsvetomir

No way, it works! copy-webpack-plugin caused it for me to. What I am wondering is how was this figured out that it was that package? Trial and error?

And how is it possible that a non-major upgrade causes this issue? Semversioning is not to be trusted within the javascript world I guess..

ghost avatar Feb 08 '18 12:02 ghost

Me too

danielchikaka avatar Feb 08 '18 12:02 danielchikaka

Solved by command : npm install [email protected]

Sushikant avatar Feb 08 '18 12:02 Sushikant

thanks @danielszenasi that fix the problem

npm install [email protected]

rfanjul avatar Feb 08 '18 12:02 rfanjul

Thought it was just me thanks @danielszenasi

Balach1 avatar Feb 08 '18 12:02 Balach1

Im using Angular 4.4.6 (CLI 1.5.0) and the fix from @danielszenasi didn't worked for me.

BreadBomb avatar Feb 08 '18 12:02 BreadBomb

@danielszenasi solution works for me, I just wasted whole day because of this issue,

waqar-imtiaz avatar Feb 08 '18 12:02 waqar-imtiaz

This does raise the question of how dependencies are managed in the project. Maybe the use of ^ isn't the best choice.

danny95djb avatar Feb 08 '18 12:02 danny95djb

npm install [email protected] worked for me

shrimank avatar Feb 08 '18 12:02 shrimank

I worked for me too

Nkemjiks avatar Feb 08 '18 12:02 Nkemjiks

I have more or less come to the same conclusion ^ on its own is worse than hell and npm together

DooMMasteR avatar Feb 08 '18 12:02 DooMMasteR

Had the same issue. Resolved by npm install [email protected].

younes-io avatar Feb 08 '18 12:02 younes-io

I have same problem for new install

ghost avatar Feb 08 '18 12:02 ghost

@danny95djb @DooMMasteR It's probably better if the package pins dependencies at specific versions. The "beauty" of npm is that this problem can occur at any level of dependencies, so it's not a 100% safe solution.

tsvetomir avatar Feb 08 '18 12:02 tsvetomir