1

我正在尝试运行此命令:

yo angular

但它给了我这个错误:

**/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:84
  if (_.isString(componentConfigFile.main)) {
                                    ^
TypeError: Cannot read property 'main' of undefined
    at findMainFiles (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:84:37)
    at /usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:146:17
    at forOwn (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:1301:15)
    at Function.forEach (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2595:9)
    at detectDependencies (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:28:5)
    at wiredep (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/wiredep.js:57:39)
    at Generator._injectDependencies (/usr/local/lib/node_modules/generator-angular/app/index.js:326:5)
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:232:13
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:113:21
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:24:16**

如何解决上述错误?注意:我正在运行 Ubuntu 14.04

4

2 回答 2

2

问题是 Git 没有安装,因为 yeoman 试图通过 Git 获取 bower_components

于 2014-07-17T11:26:15.020 回答
0

我使用nvm并在安装并切换到最新版本的节点后遇到了这个问题。我意识到我忘了在全球范围内重新安装bower

npm install -g bower

安装凉亭后,问题就消失了。

于 2014-10-17T06:47:18.873 回答