【问题标题】:node.js heroku Ghost is unable to start due to missing dependencies: Cannot find modulenode.js heroku Ghost 由于缺少依赖项而无法启动:找不到模块
【发布时间】:2015-10-06 20:22:53
【问题描述】:

我已经为此工作了几个小时,但没有运气。我刚刚将Ghost 0.7.0 下载到我的本地计算机上,并且开箱即用,npm start 运行良好。当我尝试安装我的第一个软件包时遇到了错误。我正在安装的软件包是ghost-s3-storage。但是,在部署到 heroku 时,所有包都返回类似的错误。

这是我的步骤...

$ npm start
    -> works
$ npm install --save ghost-s3-storage
$ npm start
    -> still works

所以现在我的package.json 包含准确的依赖关系,所以 Heroku 应该正确部署,但它没有。这似乎是由 Heroku 运行的三个命令引起的(根据他们的guide)。当我在本地运行命令时,我可以复制错误。

 $ rm -rf node_modules
 $ npm install --quiet --production
 $ npm start
   -> ERROR: Ghost is unable to start due to missing dependencies:
    Cannot find module 'ghost-s3-storage'

此时,我的package.json 看起来是正确的。

package.json
  "dependencies": {
    ...,
    "ghost-s3-storage": "^0.2.2",
    ...,
  }

但是,node_modules 中缺少 ghost-s3-storage

$ npm ls
   -> UNMET DEPENDENCY ghost-s3-storage@^0.2.2
   -> npm ERR! missing: ghost-s3-storage@^0.2.2, required by ghost@0.7.0

所以我很难过。 Heroku 或者 node.js 或者我是愚蠢的。请帮忙。

【问题讨论】:

  • 你解决了吗?有同样的问题。
  • 我不是。联系了我的朋友和 Heroku
  • 我用 npm shrinkwrap 为我工作了
  • 如果你在 heroku 上设置了一个 ghost 实例,请查看:github.com/cobyism/ghost-on-heroku 它还有一个完整的 config.js

标签: node.js heroku ghost


【解决方案1】:

我遇到了完全相同的问题,我通过使用 npm shrinkwrap 解决了它。

npm shrinkwrap 锁定包依赖项 (https://docs.npmjs.com/cli/shrinkwrap)

另请参阅此建议: https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git

【讨论】:

    【解决方案2】:

    我也遇到了同样的问题,可以报告运行 npm shrinkwrap,提交并部署到 Heroku 可以解决问题。

    【讨论】:

      猜你喜欢
      • 2018-04-23
      • 1970-01-01
      • 1970-01-01
      • 2018-08-10
      • 2014-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多