Yeoman composeWith找不到模块

时间:2016-05-25 17:11:19

标签: javascript node.js npm yeoman npm-install

真的很难过这个。 我写了一个发电机,里面有其他发电机。

当我使用npm链接composewith从我的本地副本安装它工作正常,但是当我从github安装生成器时,我得到错误找不到模块。

我的功能组合如下:

this.composeWith("rawnet:static", {
  options: {
    appname: this.appname,
    git: this.git,
    gruntPath: this.sourceRoot()
  }
}, {
  local: require.resolve('../static')
});

我的文件夹结构如下所示:

-app  
  -index.js  
-static  
  -index.js 

我得到的错误是:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Cannot find module '../static'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.resolve (internal/module.js:27:19)
    at module.exports.generators.Base.extend.generateSite (/usr/local/lib/node_modules/generator-rawnet/app/index.js:79:24)
    at /usr/local/lib/node_modules/generator-rawnet/node_modules/yeoman-generator/lib/base.js:421:16
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

有没有其他人反对这一点,我不明白为什么当我从我的本地运行生成器它工作正常,但是一旦我使用npm从github安装它就失败了。我已经检查了所有路径并且它们是正确的,我甚至在npm安装了生成器之后将其更改为指向正确的文件夹但它仍然无效。

任何帮助都会受到大力赞赏!

1 个答案:

答案 0 :(得分:0)

好的,所以我整晚都把头发拉了出来,今天早上通过yeoman docs创造了一台发电机的新面貌,我想出了问题所在。

我没有将我的子生成器包含在sqlQuery(conn, "select count(*) from hydr where flight= 'V0051' ") count(*) 1 142561 的{​​{1}}数组中。