【问题标题】:Yeoman composeWith cannot find moduleYeoman composeWith 找不到模块
【发布时间】:2016-05-26 16:07:09
【问题描述】:

真的被这个难住了。 我写了一个生成器,里面有其他的生成器。

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

我的 compose with function 是这样的:

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 安装生成器后将其更改为指向正确的文件夹,但仍然无法正常工作。

任何帮助将不胜感激!

【问题讨论】:

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


    【解决方案1】:

    好的,所以在整晚拔头发之后,今天早上通过 yeoman 文档中有关创建发电机的新外观,我发现了问题所在。

    我没有将我的子生成器包含在 package.jsonfiles 数组中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-14
      • 2015-07-04
      • 1970-01-01
      • 2022-12-15
      • 2014-12-04
      • 2014-10-03
      相关资源
      最近更新 更多