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
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
@topce upravu si svega ovoga nebi bilo 😂
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" }
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.