在heroku上安装jade时出错

时间:2013-01-05 15:44:22

标签: node.js heroku pug npm

将node.js-app推送到Heroku时出错。它曾经工作,但现在,由于某种原因,它失败了。

当我推送到Heroku时,我得到以下内容:

-----> Node.js app detected
-----> Resolving engine versions
   Using Node.js version: 0.6.13
   Using npm version: 1.1.4
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
   npm http GET https://registry.npmjs.org/express/2.5.9
   npm http GET https://registry.npmjs.org/jade/0.15.4
   npm http 200 https://registry.npmjs.org/jade/0.15.4
   npm http GET https://registry.npmjs.org/jade/-/jade-0.15.4.tgz
   npm http 200 https://registry.npmjs.org/express/2.5.9
   npm http GET https://registry.npmjs.org/express/-/express-2.5.9.tgz
   npm http 200 https://registry.npmjs.org/jade/-/jade-0.15.4.tgz
   npm http 200 https://registry.npmjs.org/express/-/express-2.5.9.tgz
   npm ERR! error installing jade@0.15.4

   npm ERR! Refusing to delete: /tmp/build_dzqaws2o7lx4/node_modules/.bin/jade not in /tmp/build_dzqaws2o7lx4/node_modules/jade
   npm ERR! File exists: /tmp/build_dzqaws2o7lx4/node_modules/.bin/jade
   npm ERR! Move it away, and try again.
   npm ERR!
   npm ERR! System Linux 2.6.32-348-ec2
   npm ERR! command "/tmp/node-node-HkEc/bin/node" "/tmp/node-npm-X5Wz/cli.js" "install" "--production"
   npm ERR! cwd /tmp/build_dzqaws2o7lx4
   npm ERR! node -v v0.6.13
   npm ERR! npm -v 1.1.4
   npm ERR! path /tmp/build_dzqaws2o7lx4/node_modules/.bin/jade
   npm ERR! code EEXIST
   npm ERR! message Refusing to delete: /tmp/build_dzqaws2o7lx4/node_modules/.bin/jade not in /tmp/build_dzqaws2o7lx4/node_modules/jade
   npm ERR! errno {}
   npm http GET https://registry.npmjs.org/connect
   npm http GET https://registry.npmjs.org/mime/1.2.4
   npm http GET https://registry.npmjs.org/qs
   npm http GET https://registry.npmjs.org/mkdirp/0.3.0
   npm ERR!
   npm ERR! Additional logging details can be found in:
   npm ERR!     /tmp/build_dzqaws2o7lx4/npm-debug.log
   npm not ok
 !     Failed to install --production dependencies with npm
 !     Heroku push rejected, failed to compile Node.js app

我的package.json如下:

{
  "name": "myAppName",
  "version": "0.0.1",
  "dependencies": {
      "express": "2.5.9",
      "mongoose":"3.5.2",
      "jade": "0.15.4",
      "ejs": "0.7.1"
      },
  "engines": {
    "node": "0.6.13",
    "npm": "1.1.4"
  }
}

因为它说“拒绝删除:......”我认为这可能是Heroku的一个怪异错误,所以我试图将它推到一个新的Heroku应用程序,但我得到了同样的错误。

关于什么是错的任何想法?是我的版本吗?一切都在当地运行良好(窗户)。 任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:4)

您使用的是旧node.js。尝试将以下内容添加到package.json

  "engines": {
        "node": "0.8.x",
        "npm": "1.1.x"
  },

您可以通过登录系统来更仔细地检查事物。首先,您需要安装Heroku Toolbelt(如果您还没有)。然后:

heroku login

heroku run bash --app yourapp

这将为您的heroku安装提供一个bash。导航至/tmpcd /tmp)并查看其中的内容。尝试手动删除它(rm -rf whatisleft)。

您的玉器版本也已过时(仍然)。我的heroku安装与玉有:

"jade": "*"

最后,请勿将node_modules添加到源代码管理中。因此,请将其添加到.gitignore文件中。

答案 1 :(得分:0)

您可以强制Heroku清除您应用的缓存:

$ heroku plugins:install heroku-repo
$ heroku repo:purge_cache -a appname