我使用 grunt 制作了一个静态单页网站。我现在正尝试使用 heroku-buildpack-nodejs-grunt 将它部署到 heroku对于 Node 咕噜声。
下面是我的根目录的图片:
这是我的 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/