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

Funcionó con la degradacion de webpack...pero en serio...como ha podido llegar a pasar esto? Increible...

josexs avatar Feb 08 '18 12:02 josexs

4.3.0 doesn't work for me, 4.3.1 does work.

losbeekos avatar Feb 08 '18 12:02 losbeekos

We currently investigate problem https://github.com/webpack-contrib/copy-webpack-plugin/issues/217, please don't spam. Thanks.

alexander-akait avatar Feb 08 '18 12:02 alexander-akait

I've the same error here:

Jenkins (running a slave container): image

Local (running the same container that Jenkins): image

And it seems that @ReToCode build also has the same issue: https://travis-ci.org/oscp/openshift-monitoring/builds/338959033?utm_source=github_status&utm_medium=notification

danielpsf avatar Feb 08 '18 12:02 danielpsf

Thanks ;) @danielszenasi . That worked for me.

ralfepoisson avatar Feb 08 '18 12:02 ralfepoisson

@losbeekos's solution has worked.

As I'm releasing a version today, I'll keep this workaround for now.

danielpsf avatar Feb 08 '18 12:02 danielpsf

Worked for me, tnx to all! npm install [email protected] --save p.s. I had to put --save to add to package/json Fwi, is this temp solution, or?

idukic avatar Feb 08 '18 12:02 idukic

Thank u @danny95djb and @danielszenasi! 4.3.1 does work for me

neo0910 avatar Feb 08 '18 12:02 neo0910

@idukic temp solution, because that package is at 4.4.0 and that's what broke the current setup

gajdot avatar Feb 08 '18 13:02 gajdot

Remove "favicon.ico" from .angular-cli.json in "assets" field solve problem. Investigate more deeply why it is happens

alexander-akait avatar Feb 08 '18 13:02 alexander-akait

Same issue :(

D:\a\1\s*\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:40 callbacks[i](err, result); ^ TypeError: callbacks[i] is not a function at Storage.finished (D:\a\1\s*\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:40:15) at D:\a\1\s*\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:77:9 at D:\a\1\s*\node_modules\graceful-fs\polyfills.js:287:18 at FSReqWrap.oncomplete (fs.js:153:5)

shadiqaust avatar Feb 08 '18 13:02 shadiqaust

For me adding "copy-webpack-plugin": "4.3.1" to package.json solved the problem. Thanks guys

MartynasStukas avatar Feb 08 '18 13:02 MartynasStukas

same here

eugensunic avatar Feb 08 '18 13:02 eugensunic

For Yarn users, you can override the copy-webpack-plugin version used inside CLI by adding this to your package.json:

  "resolutions": {
    "copy-webpack-plugin": "4.3.0"
  }

The semantics of this are slightly different than just manually overwriting the version once, you're telling yarn "if anything I am using depends on this package, ignore what version it thinks it wants and give it this one instead".

kylecordes avatar Feb 08 '18 13:02 kylecordes

@MartynasStukas this will not work as you wanted to. If you are on localhost it's ok but if you use gitlab-ci to build your project this solution is messy. Yes, it's a workaround for now, but this is not the desired solution. Desired solution is to hit npm install and to work without installing other libraries.

songokudbz avatar Feb 08 '18 13:02 songokudbz

"@angular/cli": "1.6.1", angular 5.0.0: solution using copy-webpack-plugin not working for me

officechuber avatar Feb 08 '18 13:02 officechuber

same problem. npm install [email protected] fix for me

angular/cli: 1.6.8 angular/material: 2.0.0-beta.12 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.3.3 webpack: 3.10.0

dogansalman avatar Feb 08 '18 13:02 dogansalman

Resole with this command : npm install [email protected]

Thanks

AlokGupta007 avatar Feb 08 '18 13:02 AlokGupta007

I also want write story & participate in this issue, which received the largest nb. of comments within one hour!

elvisbegovic avatar Feb 08 '18 13:02 elvisbegovic

npm install [email protected] --save
worked for me

shadiqaust avatar Feb 08 '18 13:02 shadiqaust