错误:您在需要流的地方提供了无效的对象.你可以提供一个 Observable、Promise、Array 或 Iterable [英] Error: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

查看:27
本文介绍了错误:您在需要流的地方提供了无效的对象.你可以提供一个 Observable、Promise、Array 或 Iterable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 cmd 行中使用ng generate component hero"生成一个名为hero"的组件,并收到以下消息:

I am trying to generate a component called "hero" using "ng generate component hero" in the cmd line and am getting the following message:

错误:您在需要流的地方提供了无效的对象.您可以提供 Observable、Promise、Array 或 Iterable.
您在需要流的地方提供了一个无效的对象.您可以提供 Observable、Promise、Array 或 Iterable.

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.

注意:在版本警告出现问题之前,错误仍然发生

我该怎么做才能解决这个问题?

What can I do to fix this?

推荐答案

解决了一个小时一样,最终得出结论:
1.我的全局和本地 CLI 不匹配(1.6.4 g vs 1.6.3 l),所以我跑了 npm install --save-dev @angular/cli@latest
2.之后是另一个警告:
错误:多个模块匹配.使用跳过导入选项跳过将组件导入最近的模块.不止一个模块匹配.使用跳过导入选项跳过将组件导入最近的模块.",
so ng g c my-component --skip-import 现在按预期工作.
我希望它会有所帮助.

for an hour was solving the same, eventually concluded:
1. My global and local CLI mismatched (1.6.4 g vs 1.6.3 l), so I ran npm install --save-dev @angular/cli@latest
2. After that that was another warning:
"Error: More than one module matches. Use skip-import option to skip importing the component into the closest module. More than one module matches. Use skip-import option to skip importing the component into the closest module.",
so ng g c my-component --skip-import now works as expected.
I hope it will help.

这篇关于错误:您在需要流的地方提供了无效的对象.你可以提供一个 Observable、Promise、Array 或 Iterable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆