【发布时间】:2018-10-27 10:47:57
【问题描述】:
我将三个 Angular 5 应用程序更新为 Angular 6,但最后一个给我带来了麻烦。 每次我尝试编译(服务/构建、jit/aot、dev/prod)时,我都会收到这个错误:
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
这个应用程序的一些特点是我在 app 文件夹旁边的 ./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
}
}
我尝试安装thisstream npm 包,但是这个版本没有 hash-base 使用的 stream.Transform 扩展。
我试过节点 8.11.1 和 10.1.0
【问题讨论】:
-
试试
npm -ls。你有没有收到包裹丢失之类的错误? -
no npm ls 没有给我任何错误
标签: angular typescript webpack angular6