当部署到Heroku时,在grunt上找不到模块
Cannot find module on grunt when deploying to Heroku
这真让我困惑。基本上,我设置了一个Go应用程序,使用Grunt作为web应用程序。
我使用https://github.com/ddollar/heroku-buildpack-multi为我的构建包结合nodejs和去构建包,我不能得到nodejs的构建包工作。
我设法安装grunt,而执行我的grunt任务只是未能获得模块。下面的Heroku输出:
Fetching repository, done.
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (10/10), 1.23 KiB | 0 bytes/s, done.
Total 10 (delta 6), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
=====> Detected Framework: Node.js
-----> Requested node range: 0.10.x
-----> Resolved node version: 0.10.30
-----> Downloading and installing node
-----> Exporting config vars to environment
-----> Installing dependencies
npm WARN optional dep failed, continuing fsevents@0.2.0
> blat@0.0.0 postinstall /tmp/build_7d4b99cb-602b-42ee-9a85-8b929a54646d
> echo postinstall time ls react; ls ./node_modules/react; echo AAA; ./node_modules/grunt-cli/bin/grunt heroku:deploy
postinstall time ls react
README.md
addons.js
dist
lib
node_modules
package.json
react.js
AAA
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'React'
Warning: Task "heroku:deploy" not found. Use --force to continue.
Aborted due to warnings.
npm ERR! blat@0.0.0 postinstall: `echo postinstall time ls react; ls ./node_modules/react; echo AAA; ./node_modules/grunt-cli/bin/grunt heroku:deploy`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the blat@0.0.0 postinstall script.
npm ERR! This is most likely a problem with the blat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! echo postinstall time ls react; ls ./node_modules/react; echo AAA; ./node_modules/grunt-cli/bin/grunt heroku:deploy
npm ERR! You can get their info via:
npm ERR! npm owner ls blat
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.11-ec2
npm ERR! command "/tmp/build_7d4b99cb-602b-42ee-9a85-8b929a54646d/vendor/node/bin/node" "/tmp/build_7d4b99cb-602b-42ee-9a85-8b929a54646d/vendor/node/bin/npm" "install" "--userconfig" "/tmp/build_7d4b99cb-602b-42ee-9
a85-8b929a54646d/.npmrc" "--production"
npm ERR! cwd /tmp/build_7d4b99cb-602b-42ee-9a85-8b929a54646d
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_7d4b99cb-602b-42ee-9a85-8b929a54646d/npm-debug.log
npm ERR! not ok code 0
请注意,我故意调用ls ./node_modules/react
来查看它是否已安装。但由于某些原因,它无法在我的节点文件中找到它。
:
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-react')
grunt.loadNpmTasks('grunt-browserify')
// doing this for testing - fails on heroku
var react= require('React')
grunt.initConfig({
browserify: {
options: {
transform: [require('grunt-react').browserify]
},
app: {
src: 'src/app.react.js',
dest: 'public/index.js'
}
},
})
grunt.registerTask('heroku:deploy', [
'browserify:app'
])
}
和包。json文件:
{
"name": "blat",
"version": "0.0.0",
"description": "",
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"dependencies": {
"director": "^1.2.3",
"es6-promise": "^1.0.0",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-react": "^0.9.0",
"react": "^0.11.1",
"react-router": "^0.5.2",
"superagent": "^0.18.2",
"superagent-prefix": "0.0.2"
},
"devDependencies": {},
"scripts": {
"postinstall": "echo postinstall time; ./node_modules/grunt-cli/bin/grunt heroku:deploy"
}
}
.buildpacks
https://github.com/heroku/heroku-buildpack-nodejs.git
https://github.com/kr/heroku-buildpack-go.git
Heroku配置:
BUILDPACK_URL = https://github.com/ddollar/heroku-buildpack-multi.git
NODE_ENV = production
有谁知道是什么问题吗?我不能在本地复制它,这太令人沮丧了。我试过https://github.com/mbuchetics/heroku-buildpack-nodejs-grunt buildpack,但它给了我相同的结果。
Ok原来是大小写敏感的问题。显然,我使用HFS+不区分大小写的格式,这解释了为什么我的代码在本地工作。
相关文章:
- grunt serve:dist时找不到Angular.js模块,但grunt serve工作正常
- Grunt:jit Grunt:插件;量角器”;找不到任务
- Sails.js+Grunt"找不到模块“”;错误
- 全局安装grunt失败,我可以'在npmjs.org上找不到
- grunt-contrib-jasmine ReferenceError: 找不到变量: jQuery.
- load-grunt-config 找不到目标任务
- 找不到从 CLI 运行 PHP 的 grunt-shell 任务
- Grunt:并发:服务器原因“;警告:任务;咖啡:服务器”;找不到&”;
- grunt是如何继续构建的,即使是grunt contrib符号链接也是如此;找不到路
- Grunt找不到任务
- $grunt构建控制失败:找不到页面jit grunt
- Grunt:错误:找不到模块'/util/task'
- 找不到Grunt任务
- 编写的第一个Grunt插件-即使Grunt.registerMultiTask()名称正确,也找不到任务
- Browserify+Grunt+Remapify:找不到模块
- 当部署到Heroku时,在grunt上找不到模块
- 在Grunt上运行的Jasmine找不到异步函数
- Grunt警告:任务;concat”;找不到
- Grunt服务器:终端中找不到命令
- Grunt Sass错误:找不到要导入的文件或不可读