5

I am trying to build a node.js project in travis-ci. this is my .travis.yml file:

language: node_js
node_js:
  - 0.8

after_script:
  # Install the Heroku package (or the Heroku toolbelt)
  - npm install heroku
  # Add your Heroku git repo:
  - git remote add heroku git@heroku.com:*****.git
  # Add your Heroku API key:
  - export HEROKU_API_KEY=KEYHERE
  # Turn off warnings about SSH keys:
  - echo "Host heroku.com" >> ~/.ssh/config
  - echo "   StrictHostKeyChecking no" >> ~/.ssh/config
  - echo "   CheckHostIP no" >> ~/.ssh/config
  - echo "   UserKnownHostsFile=/dev/null" >> ~/.ssh/config
  # Clear your current Heroku SSH keys:
  - heroku keys:clear
  # Add a new SSH key to Heroku
  - yes | heroku keys:add
  # Push to Heroku!
  - yes | git push heroku master

I get the following build error right on the beginning:

No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)

Probably because there's something wrong with my yml file and it tries to use the default ruby builder.

I don't think the file is not valid yml file as I have checked it with yml validator at http://yamllint.com/

Something wrong with my Travis specific conf ?

My package.json looks like this :

{
  "name": "csnc",
  "description": "csnc",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "express": "3.x",
    "ejs": ">=0.0.0",
    "express-partials": ">=0.0.0"
  },
  "engines": {
    "node": "0.8.x",
    "npm": "1.1.x"
  }
}

EDIT:

If you are looking for a way to automatically deploy node.js app to Heroku using Travis-CI, look for the answer I included for a working .travis.yml file

4

2 回答 2

6

您的.travis.yml文件未通过验证;您可以在http://lint.travis-ci.org/对其进行验证。

发现node_js键有问题:

检测到不受支持的 Node.js 版本。有关支持的 Node.js 版本的最新列表,请参阅http://bit.ly/travis-ci-environment上的 Travis CI 文档

尝试使用0.8.x.

于 2012-11-21T08:50:12.407 回答
1

出于某种奇怪的原因,我注意到文件开头有一个以前不存在的空格(我发誓:)。这一定是导致错误的原因。

奇怪的是,当我将节点版本从0.8更改0.6为验证器时,并没有注意到错误。也许这是验证器中的一个错误。

无论如何,我还成功地将我的节点应用程序自动部署到 Heroku。我没有在网上找到任何关于这样做的过程的文档(特别是对于节点),所以我附上了.travis.yml对我有用的文件。请注意,我不必为我的应用程序添加任何测试,没有它它可以正常工作:

language: node_js
node_js:
  - 0.8

after_script:
  # Install the Heroku package (or the Heroku toolbelt)
  - npm install heroku
  # Add your Heroku git repo:
  - git remote add heroku git@heroku.com:HEROKU_REPO_HERE.git
  # Add your Heroku API key:
  - export HEROKU_API_KEY=ENTER_KEY_HERE
  # Turn off warnings about SSH keys:
  - echo "Host heroku.com" >> ~/.ssh/config
  - echo "   StrictHostKeyChecking no" >> ~/.ssh/config
  - echo "   CheckHostIP no" >> ~/.ssh/config
  - echo "   UserKnownHostsFile=/dev/null" >> ~/.ssh/config
  # Download and install Heroku toolbelt locally
  - wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
  # Clear your current Heroku SSH keys:
  - heroku keys:clear
  # Add a new SSH key to Heroku
  - yes | heroku keys:add
  # Push to Heroku!
  - yes | git push heroku master

编辑:

我最近从 Travis.ci 搬到了 Drone.io。如果您正在寻找从 Github 到 Heroku 的自动部署,您应该检查一下,它工作得很好并且更容易设置 IMO。

https://drone.io/

于 2012-11-21T12:45:51.123 回答