Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Angular2 components.map不是一个函数_Node.js_Npm_Angular - Fatal编程技术网

Node.js Angular2 components.map不是一个函数

Node.js Angular2 components.map不是一个函数,node.js,npm,angular,Node.js,Npm,Angular,尝试加载有角度的网页时,会引发以下错误 [1] /Users/dylan/IdeaProjects/angular2-ui-prototype/code/node_modules/angular2-universal/dist/node/bootloader.js:246 [1] var directives = components.map(function (component) { [1] ^ [1]

尝试加载有角度的网页时,会引发以下错误

[1] /Users/dylan/IdeaProjects/angular2-ui-prototype/code/node_modules/angular2-universal/dist/node/bootloader.js:246
[1]         var directives = components.map(function (component) {
[1]                                     ^
[1]
[1] TypeError: components.map is not a function 
我不知道为什么会发生这个错误

节点版本:4.1.2

我可以在没有任何问题的情况下执行
npm运行构建
,并且
npm运行监视
仅在我实际加载页面时才会抛出错误

在我清除了dist和node_模块之后,在运行了npm安装之后,这个问题就开始出现了

(使用的完整命令是:
rm-rf dist/node_modules/&&npm i&&npm run build&&npm run watch&&npm run watch

我假设这可能是由于node的版本,所以我也尝试了4.4.1版本,得到了相同的结果

当我向上滚动时,确实会收到一系列类似以下的警告:

npm警告安装:ansi@0.3.1eNote:没有这样的文件或目录,重命名“/Users/dylan/.nvm/versions/node/v4.4.1/lib/node_modules/.staging/ansi-67bd84a7'->'/Users/dylan/.nvm/versions/node/v4.4.1/lib/node_modules/nodemon/node_modules/fsevents/node_modules/ansi”

我收到了很多这样的警告,所以我怀疑重命名它们是否合适。我也可以把文件夹中的所有东西都扔掉,重新开始,但我不确定在这一点上,我会做的坏事多于好事:-)


如果能为我指出正确的方向,我将不胜感激。

我已经找到了问题所在,或者说,找到了解决办法

我已将angular2通用依赖项更新为
0.101.3
,现在一切正常