我使用的blob-to-stream库需要访问节点流。我曾经得到这个错误
未找到模块:错误:无法解析“/mnt/c/Users/jbermudez/workspace/HMI_WEB_CONVERTIDORES/front/node_modules/blob-to-stream”中的“stream”
我将Stream设置为false,如this question中所述。现在我得到:
TypeError: stream.Readable is not a constructor
at blobToStream (http://localhost:4200/ing-features-recorder.js:1418:12)
at Observable._subscribe (http://localhost:4200/ing-features-recorder.js:6177:25)
at Observable._trySubscribe (http://localhost:4200/vendor.js:87730:25)
at Observable.subscribe (http://localhost:4200/vendor.js:87716:22)
at subscribeToResult (http://localhost:4200/vendor.js:97811:23)
at MergeMapSubscriber._innerSub (http://localhost:4200/vendor.js:93001:116)
at MergeMapSubscriber._tryNext (http://localhost:4200/vendor.js:92995:14)
at MergeMapSubscriber._next (http://localhost:4200/vendor.js:92978:18)
at MergeMapSubscriber.next (http://localhost:4200/vendor.js:88274:18)
at TapSubscriber._next (http://localhost:4200/vendor.js:95153:26)
我使用node 14.0和angular 10,这是我的package.json:
{
"name": "web-hmi",
"version": "0.0.0",
"scripts": {
"postinstall": "ngcc",
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"test-headless": "ng test --browsers Chromium_no_sandbox --watch=false --code-coverage",
"lint": "ng lint",
"e2e": "ng e2e",
"sonar": "sonar-scanner",
"clean": "rm -rf node_modules; rm package-lock.json",
"prenixcodegen": "rm -f src/thrifts/*",
"nixcodegen": "thrift --gen js:node,ts,es6,with_ns -r -out src/app/core/api/thrifts --I thrifts thrifts/all.thrift",
"unsecureWeb": "chrome --disable-web-security --incognito --user-data-dir=c:/temp/IC"
},
"private": true,
"dependencies": {
"@angular/animations": "~10.0.2",
"@angular/cdk": "~10.0.2",
"@angular/common": "~10.0.2",
"@angular/compiler": "~10.0.2",
"@angular/core": "~10.0.2",
"@angular/forms": "~10.0.2",
"@angular/material": "~10.0.2",
"@angular/platform-browser": "~10.0.2",
"@angular/platform-browser-dynamic": "~10.0.2",
"@angular/router": "~10.0.2",
"angular-pipes": "^10.0.0",
"moment": "^2.27.0",
"rxjs": "~6.5.5",
"thrift": "git+https://github.com/apache/thrift.git",
"timers": "~0.1.1",
"tslib": "^2.0.0",
"xml2js": "~0.4.23",
"zone.js": "~0.10.3",
"ngx-spinner": "^10.0.1",
"tar-stream": "^2.1.0",
"blob-to-stream": "^1.0.3",
"constants": "^0.0.2",
"pako": "^1.0.11",
"stream-browserify": "^3.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1000.1",
"@angular/cli": "~10.0.1",
"@angular/compiler-cli": "~10.0.2",
"@angular/language-service": "~10.0.2",
"@types/node": "~14.0.5",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/puppeteer": "~3.0.1",
"@types/tar-stream": "^2.1.0",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"puppeteer": "~3.1.0",
"sonar-scanner": "~3.1.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
},
"browser": {
"stream": false
}
}
2条答案
按热度按时间du7egjpx1#
安装
npm i stream
已经为我做了这个把戏6l7fqoea2#
在我的情况下开发人员导入
angular项目中的
import { Injectable } from '@nestjs/common';
。将其更改为
import { Injectable } from '@angular/core';
解决了问题