Nodejs部署错误到Heroku

时间:2017-11-07 08:48:10

标签: node.js heroku deployment

我有一个问题,我的Node应用程序部署到Heroku,我指定的节点和npm版本,设置proc文件,但又有问题,任何人都可以帮助我,我错了。

这是错误日志。

-----> Node.js app detected
-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NPM_CONFIG_PRODUCTION=true
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  6.7.0
       engines.npm (package.json):   3.10.3

       Resolving node version 6.7.0...
       Downloading and installing node 6.7.0...
       npm 3.10.3 already installed with node
-----> Restoring cache
       Skipping cache restore (not-found)
-----> Building dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules

       > bcrypt@1.0.3 install /tmp/build_41d193481a84256234156f8c6f5f2420/goransgit-Random-Movie-ec7e060/node_modules/bcrypt
       > node-pre-gyp install --fallback-to-build

       sh: 1: node-pre-gyp: Permission denied

       npm ERR! Linux 3.13.0-133-generic
       npm ERR! argv "/tmp/build_41d193481a84256234156f8c6f5f2420/goransgit-Random-Movie-ec7e060/.heroku/node/bin/node" "/tmp/build_41d193481a84256234156f8c6f5f2420/goransgit-Random-Movie-ec7e060/.heroku/node/bin/npm" "rebuild"
       npm ERR! node v6.7.0
       npm ERR! npm  v3.10.3
       npm ERR! code ELIFECYCLE
       npm ERR! bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`
       npm ERR! Exit status 126
       npm ERR!
       npm ERR! Failed at the bcrypt@1.0.3 install script 'node-pre-gyp install --fallback-to-build'.
       npm ERR! Make sure you have the latest version of node.js and npm installed.
       npm ERR! If you do, this is most likely a problem with the bcrypt package,
       npm ERR! not with npm itself.
       npm ERR! Tell the author that this fails on your system:
       npm ERR!     node-pre-gyp install --fallback-to-build
       npm ERR! You can get information on how to open an issue for this project with:
       npm ERR!     npm bugs bcrypt
       npm ERR! Or if that isn't available, you can get their info via:
       npm ERR!     npm owner ls bcrypt
       npm ERR! There is likely additional logging output above.

       npm ERR! Please include the following file with any support request:
       npm ERR!     /tmp/build_41d193481a84256234156f8c6f5f2420/goransgit-Random-Movie-ec7e060/npm-debug.log
-----> Build failed

       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys

       Some possible problems:

       - node_modules checked into source control
       https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits

       Love,
       Heroku

 !     Push rejected, failed to compile Node.js app.
 !     Push failed

这是我的package.json文件,包含所有必要的依赖项。

{
  "name": "Node app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",

  "scripts": {
    "start": "node index.js"
  },

  "author": "",
  "license": "ISC",

  "dependencies": {
    "bcrypt": "^1.0.3",
    "body-parser": "^1.18.2",
    "cookie-parser": "^1.4.3",
    "express-session": "^1.15.6",
    "express-validator": "^4.2.1",
    "form-validate": "0.0.7",
    "passport": "^0.4.0",
    "validator": "^9.1.1"
  },

  "engines" : {
    "node" : "6.7.0",
    "npm" : "3.10.3"
  }
}

如果有人能帮助我,谢谢。

请注意以下LOREM IPSUM Nostrud reprehenderit sed amet enim nulla pariatur ut dolore officia duis fugiat elit excepteur in nostrud duis irure in ut cillum sunt sunt ut incididunt in culpa in veniam adipisicing aliquip exercitation enim dolore exercitation mollit eu sunt irure excepteur magna mollit esse non dolor fugiat consequat ex incididunt laboris adipisicing culpa aliquip eu in dolor do excepteur quis aliquip enim eu ut dolor ex culpa ullamco deserunt in et deserunt in occaecat ex do dolor do dolore veniam est elit elit minim cupidatat mollit nisi sint non adipisicing cillum ullamco reprehenderit do nisi nulla commodo aute incididunt anim eu tempor incididunt sunt cupidatat velit dolor culpa sit est elit veniam dolor irure in irure minim dolor sit nisi est pariatur officia esse aliquip ex enint sint cupidatat eu excepteur laborum mollit ut ullamco cillum cillum venia qui laboris excepteur ex sed commodo magna adipisicing do culpa pariatur sed rephenderit eu deserunt quis adipisicing nisi sunt ad ad dolore incididunt dolor sint sint et laborum ea magna ea incididunt non esse non sunt sint est ad veniam ullamco ad dolor sint ut aliqua incididunt ullamco non nulla proident rephenderit anim esse non dolor sint pariatur aliqua excepteur irure non aute sed ut veniam laboris ad occaecat adipisicing proident劳动人口劳动者劳动者在劳动者中的临时劳动者在生活中的劳动力劳动者的生活方式中的生活方式。

1 个答案:

答案 0 :(得分:0)

一些可能的问题:   - node_modules已签入源控件

将node_modules放在.gitignore文件中。该目录不应该在git存储库中。

然后从git:

中删除目录
git rm -r node_modules
git commit -m "Remove node_modules directory"

然后推送到Heroku

我建议将这个gitignore文件用于Node.js项目: https://github.com/github/gitignore/blob/master/Node.gitignore