在Amazon ElasticBeanstalk中运行Sails.js应用程序时出现Grunt错误

时间:2016-02-29 08:51:56

标签: node.js amazon-web-services sails.js elastic-beanstalk

我正在将Heroku上托管的Sails.js应用程序移动到Amazon ElasticBeanstalk。当应用程序启动时,它会抛出以下Grunt错误(从eb logs拉出):

info:    Sails              <|    .-..-.
info:    v0.11.5             |\
info:                       /|.\
info:                      / || \
info:                    ,'  |'  \
info:                 .-'.-==|/_--'
info:                 `--'-------'
info:    __---___--___---___--___---___--___
info:  ____---___--___---___--___---___--___-__
info:
info: Server lifted in `/var/app/current`
info: To see your app, visit http://localhost:8081
info: To shut down Sails, press <CTRL> + C at any time.

debug: --------------------------------------------------------
debug: :: Mon Feb 29 2016 08:21:46 GMT+0000 (UTC)

debug: Environment : development
debug: Port        : 8081
debug: --------------------------------------------------------
error: ** Grunt :: An error occurred. **
error:
------------------------------------------------------------------------
>> FileError: '../bower_components/bootstrap/less/grid.less' wasn't found in assets/styles/importer.less on line 9, column 1:
>> 8 // Import Bootstrap
>> 9 @import "../bower_components/bootstrap/less/grid.less";
>> 10 @import "../bower_components/bootstrap/less/mixins.less";
Warning: Error compiling assets/styles/importer.less

Aborted due to warnings.
Running "less:dev" (less) task
------------------------------------------------------------------------

error: Looks like a Grunt error occurred--
error: Please fix it, then **restart Sails** to continue running tasks (e.g. watching for changes in assets)
error: Or if you're stuck, check out the troubleshooting tips below.

error: Troubleshooting tips:
error:
error:  *-> Are "grunt" and related grunt task modules installed locally?  Run `npm install` if you're not sure.
error:
error:  *-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
error:
error:  *-> Or maybe you don't have permissions to access the `.tmp` directory?
error:      e.g., `/var/app/current/.tmp` ?
error:
error:      If you think this might be the case, try running:
error:      sudo chown -R 497 /var/app/current/.tmp

相同的代码在我的本地开发笔记本电脑和Heroku上运行良好,但在ElasticBeanstalk上运行不正常。为什么找不到引导程序文件?这是一个PaaS,我甚至无法运行日志推荐的推荐sudo chown命令。另外要明确的是,我在package.json文件中有以下命令:

"scripts": {
    "postinstall": "bower install; grunt build",
    "debug": "node debug app.js",
    "start": "node app.js"
}

我已指示脚本在机器中安装NPM软件包后运行bower install。我的/ assets文件夹中的所有图像似乎都没有加载。不知道发生了什么事。请帮忙。

0 个答案:

没有答案