json - 将 Grunt 应用程序部署到 heroku 时,NPM 不会安装模块依赖项

标签 json node.js heroku gruntjs

我使用 grunt 制作了一个静态单页网站。我现在正尝试使用 heroku-buildpack-nodejs-grunt 将它部署到 heroku对于 Node 咕噜声。

下面是我的根目录的图片:

project root directory image

这是我的 Gruntfile package.json :

程序文件:

web: node index.html

当我运行 $ git push heroku master 时,它到达 Gruntfile 并失败:

-----> Found Gruntfile, running grunt heroku:production task
>> Local Npm module "grunt-contrib-uglify" not found. Is it installed?

上述错误继续列出所有未找到的本地 NPM 模块。如果我列出所有 loadNpmTasks 而不是使用“load-grunt-tasks”,我会得到完全相同的错误。

当我 $ heroku logs 我得到:

Starting process with command `node web.js`
Error: Cannot find module '/app/web.js'

谁能看出我哪里出错了?

最佳答案

对于路过这里的任何人,我都无法解决问题。这是我要去的地方:

在我的 Gruntfile 中,我将 npm 模块从 devDependencies 移到了 dependencies。然后 Heroku 能够安装这些依赖项。

但是,当 Heroku 运行这些任务时,它会在 haml 任务处停止并出现错误“您需要安装 Ruby 和 Haml 并在您的 PATH 中才能执行此任务”。将 ruby​​ 和 haml 添加到 Gruntfile 作为引擎不起作用。

关于json - 将 Grunt 应用程序部署到 heroku 时,NPM 不会安装模块依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20682060/

相关文章:

json - 将 JSON 反序列化为扁平化类

javascript - Azure CORS 问题上托管的 Angular 4 前端

node.js - 无法获取 JSON 对象形式的集合用户 (getuser())

ruby-on-rails - 在 heroku 中是否可以返回应用程序的备份列表?

javascript - 如何将 JSON 与 Google 可视化地理 map 结合使用

javascript - Laravel 将 json 传递给 vue.js

json - 压缩小块数据

node.js - Haste 模块映射中不存在模块 `scheduler`

ruby-on-rails - ActionView::Template::Error (PG::UndefinedColumn: ERROR: column posts.user_id does not exist

git - Heroku Git Repo 是公开的吗?