Heroku无法部署ENOENT

雷米

我一直在尝试在heroku上部署我的应用程序,但我一直遇到相同的错误:

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

       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)

       Resolving node version 8.x...
       Downloading and installing node 8.11.1...
       Using default npm version: 5.6.0
-----> Restoring cache
       Skipping cache restore (not-found)
-----> Building dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       npm ERR! path /tmp/build_b970b614b48136e1f3dc8a90ee8f11d9/node_modules/har-validator/bin/har-validator
       npm ERR! code ENOENT
       npm ERR! errno -2
       npm ERR! syscall chmod
       npm ERR! enoent ENOENT: no such file or directory, chmod '/tmp/build_b970b614b48136e1f3dc8a90ee8f11d9/node_modules/har-validator/bin/har-validator'
       npm ERR! enoent This is related to npm not being able to find a file.
       npm ERR! enoent

       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.wtPoJ/_logs/2018-05-02T14_48_40_930Z-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

       - Node version not specified in package.json
       https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

       Love,
       Heroku

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

如果我先运行npm,然后再启动npm,则该应用程序可以在本地主机上正常运行,我试图完全重建我的package.json,我试图完全删除heroku应用程序并重新创建一个,似乎无济于事。

我的package.json看起来像这样,可能是最标准的:

{
  "name": "LAD",
  "version": "1.0.0",
  "description": "xxxxx",
  "repository": "git://github.com/xxx/xxx-LAD",
  "author": "xxxx",
  "license": "xxxxx",
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "^1.18.2",
    "bootstrap": "^3.3.7",
    "compile-sass": "0.0.3",
    "connect-ensure-login": "^0.1.1",
    "connect-flash": "^0.1.1",
    "cookie-parser": "^1.4.3",
    "ejs": "^2.5.9",
    "express": "^4.16.3",
    "express-session": "^1.15.6",
    "morgan": "^1.9.0",
    "passport": "^0.4.0",
    "passport-auth0": "^0.6.1",
    "path": "^0.12.7",
    "serve-favicon": "^2.5.0"
  }
}
surreal_sai

你尝试添加node_modules到您的.gitignore文件和在检查gitignore文件?

我假设Heroku正在抱怨,因为它正在尝试安装,node_modules但它已经看到了node_modules在相同位置调用的文件夹

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章