错误:您提供了一个无效的对象,该对象应在该对象的流中.您可以提供一个Observable,Promise,Array或Iterable [英] Error: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or 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.
注意:在版本警告出现问题之前,错误仍然存在
该如何解决?
推荐答案
一个小时正在解决相同问题,最终得出结论:
1.我的全局和本地CLI不匹配(1.6.4 g和1.6.3 l),
所以我跑了npm install --save-dev @angular/cli@latest
2.在那之后是另一条警告:
错误:多个模块匹配.使用skip-import选项可以跳过将组件导入到最近的模块中的操作.
多个模块匹配.使用skip-import选项可以跳过将组件导入到最近的模块中的过程.",
所以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屋!