尝试为应用程序提供服务时发送此错误
86%hashingcrypto.js:74 this._handle.update(data,encoding); ^ TypeError:数据必须是字符串或缓冲区 在TypeError(本机) 在Hash.update(crypto.js:74:16) 在HarmonyExportImportedSpecifierDependency.updateHash (C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular- src \ node_modules \ @angular \ cli \ node_modules \ webpack \ lib \ dependencies \ HarmonyExportImportedSpecifierDependency.js:144:8) 在C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ @angular \ cli \ node_modules \ webpack \ lib \ DependenciesBlock.js:33:5 at Array.forEach(native) 在NormalModule.DependenciesBlock.updateHash(C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ @angular \ cli \ node_modules \ webpack \ lib \ DependenciesBlock.js:32:20) 在NormalModule.Module.updateHash(C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ @angular \ cli \ node_modules \ webpack \ lib \ Module.js:162:41) 在NormalModule.updateHash(C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ @angular \ cli \ node_modules \ webpack \ lib \ NormalModule.js:327:30) 在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) 在Chunk.updateHash(C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ @angular \ cli \ node_modules \ webpack \ lib \ Chunk.js:253:16) 在Compilation.createHash(C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ @angular \ cli \ node_modules \ webpack \ lib \ Compilation.js:1121:10) 在sealPart2(C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ @angular \ cli \ node_modules \ webpack \ lib \ Compilation.js:605:9) 在下一个(C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ tapable \ lib \ Tapable.js:138:11) 在汇编。 (C:\ Users \用户seanr \项目\ DerrickAlphaFebTest \角型钢\ node_modules \ @angular \ CLI \ node_modules \的WebPack \ lib中\ ProgressPlugin.js:110:5) 在下一个(C:\ Users \ seanr \ projects \ DerrickAlphaFebTest \ angular-src \ node_modules \ tapable \ lib \ Tapable.js:140:14)
答案 0 :(得分:3)
您可以通过手动编辑以下文件来改进错误消息:node_modules / webpack / lib / dependencies / HarmonyExportImportedSpecifierDependency.js并在第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);
}
然后你可以得到明确的错误信息
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);
然后搜索请求中指定的文件,此处为 @ angular / cdk / a11y
在我的情况下,我发现,名为@ angular / cdk / a11y的文件丢失了。我安装了丢失的文件以使其正常工作
答案 1 :(得分:0)
我想通了我刚开始一个新项目并复制了package.json和node_modules并修复了所有内容。