0
votes

Sends this error when trying to ng serve the application

86% hashingcrypto.js:74 this._handle.update(data, encoding); ^ TypeError: Data must be a string or a buffer at TypeError (native) at Hash.update (crypto.js:74:16) at HarmonyExportImportedSpecifierDependency.updateHash (C:\Users\seanr\projects\DerrickAlphaFebTest\angular- src\node_modules\@angular\cli\node_modules\webpack\lib\dependencies\HarmonyExportImportedSpecifierDependency.js:144:8) at C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\DependenciesBlock.js:33:5 at Array.forEach (native) at NormalModule.DependenciesBlock.updateHash (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\DependenciesBlock.js:32:20) at NormalModule.Module.updateHash (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\Module.js:162:41) at NormalModule.updateHash (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\NormalModule.js:327:30) at modules.forEach.m (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\Chunk.js:253:31) at Array.forEach (native) at Chunk.updateHash (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\Chunk.js:253:16) at Compilation.createHash (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:1121:10) at sealPart2 (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:605:9) at next (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\tapable\lib\Tapable.js:138:11) at Compilation. (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\@angular\cli\node_modules\webpack\lib\ProgressPlugin.js:110:5) at next (C:\Users\seanr\projects\DerrickAlphaFebTest\angular-src\node_modules\tapable\lib\Tapable.js:140:14)

2
It's very hard to debug such a problem. There are many dependencies with libraries and also node version (which is what?). The best approach is to remove things one by one until it stops breaking; or, work the other way around, by starting a new app, then adding things one by one until it stops working. The first thing to try is upgrading angular-cli to 1.0.0.user663031
might be related to this: github.com/webpack/webpack/issues/4072 ? please see comments.Ahmed Musallam

2 Answers

3
votes

You can improve the error message by manually editing the following file: node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js and insert some log at line 144:

     updateHash(hash) {
      super.updateHash(hash);
      const hashValue = this.getHashValue(this.importDependency.module);
      if (this.importDependency.module != null){
         // console.log('Module resource: ',       this.importDependency.module.resource);
      }else{
         console.log('\nFile not found: ', this.importDependency);
      }
      hash.update(hashValue);
   }

then you can get clear error message

86% hashing                                  
File not found:  HarmonyImportDependency {
module: null,
request: '@angular/cdk/a11y',
userRequest: '@angular/cdk/a11y',
range: [ 237, 339 ],
importedVar: '__WEBPACK_IMPORTED_MODULE_1__angular_cdk_a11y__',
loc: 
SourceLocation {
 start: Position { line: 9, column: 0 },
 end: Position { line: 9, column: 102 } } }
crypto.js:97
this._handle.update(data, encoding);

then search for the file specified in request, here it is @angular/cdk/a11y

in my case i found that,the file named @angular/cdk/a11y was missing. I installed the missing file to get it working

Reference:Thanks to toub's answer in github

0
votes

I figured it out I just started a new project and copied over the package.json and node_modules and that fixed everything.