【问题标题】:Impossible to push to Heroku - Push rejected, failed to compile Node.js app无法推送到 Heroku - 推送被拒绝,无法编译 Node.js 应用程序
【发布时间】:2018-05-02 20:50:51
【问题描述】:

我不知道为什么,但不可能推动 Heroku。 我没有发现错误:/。 感谢您的帮助^^。

这是一个带有 React 客户端的快速应用程序(使用指南针)

BuildPack -> https://github.com/stephanmelzer/heroku-buildpack-nodejs-grunt-compass.git

-----> 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):  9.11.1
       engines.npm (package.json):   unspecified (use default)

       Resolving node version 9.11.1...
       Downloading and installing node 9.11.1...
       Using default npm version: 5.6.0
-----> Restoring cache
       Skipping cache restore (new-signature)
-----> Building dependencies
       Installing node modules (package.json + package-lock)
       added 365 packages in 8.599s
-----> Caching build
       Clearing previous node cache
       Saving 2 cacheDirectories (default):
       - node_modules
       - bower_components (nothing to cache)
-----> Pruning devDependencies
       Skipping because npm 5.6.0 sometimes fails when running 'npm prune' due to a known issue
       https://github.com/npm/npm/issues/19356

       You can silence this warning by updating to at least npm 5.7.1 in your package.json
       https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version
-----> Build succeeded!
-----> Node.js app detected
-----> Requested node range:  9.11.1
-----> Resolved node version: 9.11.1
-----> Downloading and installing node
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

【问题讨论】:

标签: node.js heroku deployment


【解决方案1】:

您必须在 .gitignore 中添加 npm 依赖项文件夹 (node_modules)

here

【讨论】:

    【解决方案2】:

    请按照以下步骤将数据推送到heroku。

    1. heroku 创建“应用名称”
    2. heroku git:clone -a "创建的应用名称"
    3. heroku git:remote -a "应用名称"
    4. git 添加。
    5. git commit -am "初始提交"
    6. git pull heroku master
    7. git push heroku master

    在package.json里面添加

    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node app.js"
    

    } 欲了解更多详情,请访问 - https://www.heroku.com/nodejs

    【讨论】:

      猜你喜欢
      • 2020-09-24
      • 2016-01-10
      • 2018-12-16
      • 2020-06-05
      • 2014-02-08
      • 2014-04-14
      • 2023-03-07
      • 2016-02-25
      • 1970-01-01
      相关资源
      最近更新 更多