Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DanielStep opened this issue Feb 8, 2018 · 184 comments
Closed

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

DanielStep opened this issue Feb 8, 2018 · 184 comments
Assignees
Labels
freq4: critical Happens to many users every day P0 Issue that causes an outage, breakage, or major function to be unusable, with no known workarounds type: bug/fix type: faq

Comments

@DanielStep
Copy link

DanielStep commented Feb 8, 2018

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

@aromero86
Copy link

The same here

@ghost
Copy link

ghost commented Feb 8, 2018

Same issue here

@rsaenen
Copy link

rsaenen commented Feb 8, 2018

Linked to #9549

@pedrokelvin
Copy link

Same here :(

@JoSeTe4ever
Copy link

Show we revert to a previous version?

@Rahulkr2
Copy link

Rahulkr2 commented Feb 8, 2018

Same here yesterday it worked but today I m also getting same error.

@destiny07
Copy link

same. just got this error today.

@pedrokelvin
Copy link

First time I'm trying Angular. Not a good day lol

@Rookwing
Copy link

Rookwing commented Feb 8, 2018

I'm in the same boat with @pedrokelvin

@hudzenko
Copy link

hudzenko commented Feb 8, 2018

Same!

@brunano21
Copy link

Same here - it was working fine on yesterday.
My setup:

Angular CLI: 1.5.5
Node: 8.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.5.5
@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.8.5
@schematics/angular: 0.1.17
typescript: 2.7.1
webpack: 3.8.1

@RafaPegorari
Copy link

I have the same problem.

.../node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40
		callbacks[i](err, result);
		            ^
TypeError: callbacks[i] is not a function

Versions

@angular/core": "^5.2.4
@angular/cli": "^1.6.8
Node 9.4.0

Dependencies

"webpack": "3.10.0",
"enhanced-resolve": "3.4.1",

@tsvetomir
Copy link

Please use reactions for "me too" comments. My inbox would appreciate it, thanks!

@vovcyan
Copy link

vovcyan commented Feb 8, 2018

Me too

2 similar comments
@kodermax
Copy link

kodermax commented Feb 8, 2018

Me too

@Rahulkr2
Copy link

Rahulkr2 commented Feb 8, 2018

Me too

@neshkatrapati
Copy link

Me too.
But, could not get it working even with the previous version

@gvidon
Copy link

gvidon commented Feb 8, 2018

@skorunka tried the same — didn't work for me

# ng --version

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
    
Angular CLI: 1.6.7
Node: 9.3.0
OS: darwin x64
Angular: 5.2.0
... 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.0.29
@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
# ng serve

** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 95% emitting/Users/nide/Code/hubs/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40
		callbacks[i](err, result);
		            ^

TypeError: callbacks[i] is not a function
    at Storage.finished (/Users/nide/Code/hubs/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:40:15)
    at /Users/nide/Code/hubs/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:77:9
    at /Users/nide/Code/hubs/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:167:5)

@bop10
Copy link

bop10 commented Feb 8, 2018

Looks like something is superbroken, but i don't know what to do. I tried to downgrade cli to 1.6.7 but it didn't work.
People is having the same problem even with CLI 1.5, so i think this might be an Angular problem, not only CLI.

@gvidon
Copy link

gvidon commented Feb 8, 2018

"enhanced-resolve": "^3.4.1",

Those who use semver are probably big fans of issues described in this thread.

  • Stop using semver!
  • setup greenkeeper or similar software.

@demiro
Copy link

demiro commented Feb 8, 2018

same problem here... we are blocked on so many levels!

@yacineblr
Copy link

same for me

@Sushikant
Copy link

same problem here too... :(

@DooMMasteR
Copy link

some other deps prevent me from using 1.6.6 which worked until today.
so the issue might have gotten pulled in from the outside, I hate the way npm resolves, and even pinning 1.6.6 in my package.json results in 1.6.8 being installed

@VytenisJ
Copy link

VytenisJ commented Feb 8, 2018

same problem here :(

@cmvalentine
Copy link

cmvalentine commented Feb 8, 2018

A rollback to ~1.3.0 in your package.json fixes the issue for me as it removes the dependency on copy-webpack-plugin but it's not exactly something I want to keep long term.

@fabiobiondi
Copy link

fabiobiondi commented Feb 8, 2018

Same here and I had the same problem last month with angular-cli 1.5.x (but a different issue: angular-devkit/core not found).
Now I'm using 1.6.6 but it worked until yesterday

@idukic
Copy link

idukic commented Feb 8, 2018

same for me!

Angular CLI: 1.5.5
Node: 6.11.0
OS: win32 x64
Angular: 4.4.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, tsc-wrapped

@angular/cli: 1.5.5
@angular-devkit/build-optimizer: 0.0.41
@angular-devkit/core: 0.0.28
@angular-devkit/schematics: 0.0.51
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.5
@schematics/angular: 0.1.16
typescript: 2.6.2
webpack: 3.8.1

@TsongSteven
Copy link

$ npm install copy-webpack-plugin@4.3.0
This command worked for me..

@filipesilva
Copy link
Contributor

Hi all,

copy-webpack-plugin@4.4.1 was just released with a fix that addresses this problem (webpack-contrib/copy-webpack-plugin#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:

  • npm install copy-webpack-plugin@4.4.1
  • npm uninstall copy-webpack-plugin@4.4.1 installing and uninstalling should force the npm to resolve and dedupe to 4.4.1
  • npm ls copy-webpack-plugin should show copy-webpack-plugin@4.4.1 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 #9550 (comment).

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.

@jcyovera
Copy link

jcyovera commented Feb 8, 2018

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

@angular angular locked as resolved and limited conversation to collaborators Feb 8, 2018
@filipesilva filipesilva reopened this Feb 8, 2018
@filipesilva
Copy link
Contributor

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.

@angular angular unlocked this conversation Feb 8, 2018
bepremeg added a commit to WegenenVerkeer/ng-kaart that referenced this issue Feb 8, 2018
aangepast: versie van copy-webpack-plugin opgehoogd omwille van
upstream up. angular/angular-cli#9550.
@darrell-parkhouse5151
Copy link

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

@slashinski
Copy link

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

@yinonov
Copy link

yinonov commented Feb 8, 2018

Uninstall and reinstall angular cli again. Issue is already solved

@hansl
Copy link
Contributor

hansl commented Feb 8, 2018

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

@hansl hansl closed this as completed Feb 8, 2018
@gilbertogwa
Copy link

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

@kedar9444
Copy link

deleting package-lock.json and npm install copy-webpack-plugin@4.3.0 worked for us. Cheers!!!

@adnanrafique
Copy link

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

@mazulatas
Copy link

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

@dandro32
Copy link

dandro32 commented Feb 9, 2018

After updating and trying build version still got this error
obraz

@sathhya
Copy link

sathhya commented Feb 9, 2018

npm install copy-webpack-plugin@4.3.0 --save

Its Working For Me ..Thanks :)

@albertnadal
Copy link

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

@danny95djb
Copy link

@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

@wilfried11
Copy link

wilfried11 commented Feb 9, 2018

npm install copy-webpack-plugin@4.4.0
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

@topce
Copy link

topce commented Feb 11, 2018

so error was in in third party lib "copy-webpack-plugin": "^4.1.1",
if angular-cli team hard coded dependency like "copy-webpack-plugin":"4.1.1"
this error would not happened
in this case authors of code-webpack-plugin would not know so fast that they have error in one release

so maybe npm community need to be less optimistic about semantic versioning
and to remove tildes and carets from package json in order to have more robust
predicable builds

angular can start first and lets hope that other npm projects will follow

it is not first (last) time this stuff happened it could be even worst
that some deeper dependency broke build
cure is simple in all packege.json remove tildes and and carets
use https://www.npmjs.com/package/npm-check-updates to manually manage project dependencies
run ncu - u
run npm i
run all tests and if it is OK publish

another option is maybe to have in npm option to run it without semantic versioning
without tildes and carets so if somebody
does not want to test semantic versioning he can do it with
for example command
npm i --stable
where npm could install version without tildes and carets
maybe it already exitst but nobody use it or know about it

of course this is not ng cli problem it is general problem with semantic versioning

angular team is doing great job and lets hope that they will attack
problem to have more robust builds

svega ovoga nebi bilo da je pera otisao u policiju

@elvisbegovic
Copy link
Contributor

@topce upravu si svega ovoga nebi bilo 😂

@TrescoNet
Copy link

After a new installation and package update from package.json, "ng test" still gives errors.

The following solutions, found on Internet, did not work for me:

  • move "import 'zone.js / dist / zones-testing';" at the end of the imports on test.ts file;
  • uninstalling and reinstalling "@ angular / cli";
  • deleting node-modules, package-lock.json and reinstalling all with "npm install";
  • install the copy-webpack-plugin package;

The only good option was to downgrade "jasmine-core" to "2.99.0"

Here are the dependencies used:

"dependencies": {
"@angular/animations": "^5.2.7",
"@angular/common": "^5.2.7",
"@angular/compiler": "^5.2.7",
"@angular/core": "^5.2.7",
"@angular/forms": "^5.2.7",
"@angular/http": "^5.2.7",
"@angular/platform-browser": "^5.2.7",
"@angular/platform-browser-dynamic": "^5.2.7",
"@angular/router": "^5.2.7",
"core-js": "^2.5.3",
"rxjs": "^5.5.6",
"zone.js": "^0.8.20"
},
"devDependencies": {
"@angular/cli": "^1.7.2",
"@angular/compiler-cli": "^5.2.7",
"@angular/language-service": "^5.2.7",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~9.4.6",
"codelyzer": "^4.2.1",
"jasmine-core": "~2.99.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.4.1",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.6.2"
}

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freq4: critical Happens to many users every day P0 Issue that causes an outage, breakage, or major function to be unusable, with no known workarounds type: bug/fix type: faq
Projects
None yet
Development

No branches or pull requests