gpt4 book ai didi

Angular 6 : Failed to compile: Can't resolve 'stream' in ./node_modules/hash-base

转载 作者:搜寻专家 更新时间:2023-10-30 21:48:26 27 4
gpt4 key购买 nike

我将三个 Angular 5 应用程序更新到 Angular 6,但最后一个给我带来了麻烦。每次我尝试编译(服务/构建、jit/aot、开发/生产)时,我都会收到此错误:

ERROR in ./node_modules/hash-base/index.js
Module not found: Error: Can't resolve 'stream' in '[...]/node_modules/hash-base'
ℹ 「wdm」: Failed to compile.

hash-base 似乎是 webpack 的依赖:

@eagle5/editor-app@0.2.6
└─┬ @angular-devkit/build-angular@0.6.1
└─┬ webpack@4.6.0
└─┬ node-libs-browser@2.1.0
└─┬ crypto-browserify@3.12.0
└─┬ create-hash@1.2.0
├─┬ md5.js@1.3.4
│ └── hash-base@3.0.4
└─┬ ripemd160@2.0.2
└── hash-base@3.0.4 deduped

这个应用程序的一些特点是我在应用程序文件夹旁边的 ./src 中有一个框架,我安装了一个 git 存储库作为 npm 包,并在我的 tsconfig.json 中导入了一些 typescript 定义:

{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
],
"paths": {
"@nettrek/*": [
"./@nettrek/*"
]
}
},
"include": [
"./src/**/*",
"./node_modules/@eagle5/player-core/dto/**/*"
],
"angularCompilerOptions": {
"preserveWhitespaces": false
}
}

我尝试安装 this stream npm 包,但此版本没有 hash-base 使用的 stream.Transform 扩展。

我试过节点 8.11.1 和 10.1.0

最佳答案

好的,我找到了错误的原因。我们自己在一个类中使用了 md5.js,但忘记将其放入我们的 package.json 中,因为它已经安装好了。Md5.js 当然需要 Angular 6 不再支持的浏览器垫片中的节点。

关于 Angular 6 : Failed to compile: Can't resolve 'stream' in ./node_modules/hash-base,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50386837/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com