【问题标题】:Angular CLI ng new errorAngular CLI 出现新错误
【发布时间】:2018-06-21 09:18:24
【问题描述】:

我已经从 https://nodejs.org/en/download 安装了节点,然后我通过 NPM 安装了 angular CLI 使用

npm install -g @angular/cli

完成后,我尝试创建一个新的 Angular 项目

ng new new-project

我收到以下错误

Error: You provided an invalid object where a stream was expected.
  You can provide an Observable, Promise, Array, or Iterable.
You provided an invalid object where a stream was expected.
  You can provide an Observable, Promise, Array, or Iterable.

我尝试使用 sudo(和不使用)安装 cli,但我已经重新安装了节点:我总是遇到同样的错误。

我找不到任何关于有此问题的人的信息。

我正在使用 MacOS。

【问题讨论】:

    标签: node.js angular angular-cli


    【解决方案1】:

    尝试使用旧版本的 Angular CLI,直到这个问题得到解决。

    您可以在https://github.com/angular/angular-cli/issues/9172关注此问题。

    编辑:我找到了解决方案,运行以下命令:

    npm un -g @angular/cli
    npm cache clean --force
    npm i -g @angular/cli
    

    它对我有用。

    【讨论】:

      【解决方案2】:

      我按照步骤进行

      • 更新节点,npm 最新版本
      • 删除 angular-cli 1.6.3
      • 安装 angular-cli 1.5

      我可以创建应用程序、组件等

      1 月 12 日更新

      我将 angular-cli 更新到 1.6.4,Node 更新到 9.4.0,并为我创建新项目工作正常

      【讨论】:

        【解决方案3】:

        问题已解决。

        删除node_modules 并运行npm install 以获取最新的依赖项。

        【讨论】:

          【解决方案4】:

          已确认问题:

          Angular CLI:1.6.3 节点:6.10.3 操作系统:win32 x64

          Angular CLI:1.6.3 节点:6.10.3 操作系统:linux x64

          Angular CLI:1.6.4 节点:8.0.0 操作系统:win32 x64

          在每种情况下,我都使用 nvm。

          在卸载并专门安装 angular cli 1.5.5 版后工作

          【讨论】:

            【解决方案5】:

            https://github.com/angular/angular-cli/issues/9187关注这个问题

            在您的项目中安装

            npm install @angular-devkit/schematics
            

            ng -v

            Angular CLI: 1.6.3
            Node: 9.2.0
            OS: linux x64
            Angular: 5.2.0
            

            【讨论】:

              猜你喜欢
              • 2023-03-29
              • 2019-07-07
              • 1970-01-01
              • 1970-01-01
              • 2017-11-15
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多