Build上的Angular 9错误:找不到名称WriteStream和ReadStream

时间:2020-04-22 15:23:47

标签: angular

自从我更新到Angular 9以来,我无法构建我的应用程序。 ng serve运作良好。打字稿似乎是错误,但我不明白。

你能帮我吗?

构建时出错:

ERROR in node_modules/@types/node/globals.d.ts:838:17 - error TS2304: Cannot find name 'WriteStream'.
838         stdout: WriteStream;
                    ~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:842:17 - error TS2304: Cannot find name 'WriteStream'.
842         stderr: WriteStream;
                    ~~~~~~~~~~~
node_modules/@types/node/globals.d.ts:843:16 - error TS2304: Cannot find name 'ReadStream'.
843         stdin: ReadStream;
                   ~~~~~~~~~~

我的Angular配置:

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.1.1
Node: 12.16.2
OS: linux x64

Angular: 9.1.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.1
@angular-devkit/build-angular     0.901.1
@angular-devkit/build-optimizer   0.901.1
@angular-devkit/build-webpack     0.901.1
@angular-devkit/core              9.1.1
@angular-devkit/schematics        9.1.1
@angular/cli                      9.1.1
@ngtools/webpack                  9.1.1
@schematics/angular               9.1.1
@schematics/update                0.901.1
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

1 个答案:

答案 0 :(得分:1)

我阅读了我的最后一次提交,并且看到了一些非常有趣的东西!

我使用自动提取npm版本的Sentry(https://docs.sentry.io/workflow/releases/?platform=javascript)设置了发布跟踪

版本:process.env.npm_package_version

和我的IDE(Webstorm)自动在tsconfig.app.json中添加一行。

  "files": [
    ...,
    "../node_modules/@types/node/globals.d.ts"

如果没有这行,它会很好地工作,但是我必须手动编写版本!