0

I'm trying to push my nodejs, express (backend) and react (font end) with git push heroku master.

But have rejected:

-----> Node.js app detected

-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false

-----> Installing binaries
       engines.node (package.json):  10.15.1
       engines.npm (package.json):   6.4.1

       Resolving node version 10.15.1...
       Downloading and installing node 10.15.1...
       npm 6.4.1 already installed with node

-----> Restoring cache
       - node_modules

-----> Building dependencies
       Installing node modules (package.json)
       removed 231 packages and audited 201 packages in 3.657s
       found 0 vulnerabilities

       Running heroku-postbuild

       > [email protected] heroku-postbuild /tmp/build_fcf0465a8c2c68ad9a71497722565a7a
       > cd client && npm && npm run build


       Usage: npm <command>

       where <command> is one of:
           access, adduser, audit, bin, bugs, c, cache, ci, cit,
           completion, config, create, ddp, dedupe, deprecate,
           dist-tag, docs, doctor, edit, explore, get, help,
           help-search, hook, i, init, install, install-test, it, link,
           list, ln, login, logout, ls, outdated, owner, pack, ping,
           prefix, profile, prune, publish, rb, rebuild, repo, restart,
           root, run, run-script, s, se, search, set, shrinkwrap, star,
           stars, start, stop, t, team, test, token, tst, un,
           uninstall, unpublish, unstar, up, update, v, version, view,
           whoami

       npm <command> -h  quick help on <command>
       npm -l            display full usage info
       npm help <term>   search for help on <term>
       npm help npm      involved overview

       Specify configs in the ini-formatted file:
           /app/.npmrc
       or on the command line via: npm <command> --key value
       Config info can be viewed via: npm help config

       [email protected] /tmp/build_fcf0465a8c2c68ad9a71497722565a7a/.heroku/node/lib/node_modules/npm
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] heroku-postbuild: `cd client && npm && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.x0XkK/_logs/2019-02-24T14_05_47_120Z-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

       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/

       Love,
       Heroku

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

Here is my package.json

{
    "name": "twituet",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "start": "node index.js",
        "heroku-postbuild": "cd client && npm && npm run build"
    },
    "keywords": [],
    "author": "vuong xuan",
    "license": "ISC",
    "dependencies": {
        "body-parser": "^1.18.3",
        "cors": "^2.8.5",
        "express": "^4.16.4",
        "mongoose": "^5.4.14",
        "morgan": "^1.9.1"
    },
    "engines": {
        "node": "10.15.1",
        "npm": "6.4.1"
    }
}

What i'm doing wrong. Pls help me...

I tried this solution but it didnt work Push rejected, failed to compile Node.js app heroku

6
  • 1
    What does npm in cd client && npm && npm run build do? Shouldn't it be npm install? Commented Feb 24, 2019 at 14:19
  • didn' work :(... Commented Feb 24, 2019 at 14:22
  • this tell Heroku go into client Commented Feb 24, 2019 at 14:24
  • use "heroku-postbuild": "cd client && npm install && npm run build" Commented Feb 24, 2019 at 14:25
  • yes, yes i did. Commented Feb 24, 2019 at 14:27

2 Answers 2

2

Since you are executing npm command without passing any argument that is why is failing.

Look at this line "heroku-postbuild": "cd client && npm && npm run build"

And change it to "heroku-postbuild": "cd client && npm install && npm run build"

npm <command> is the correct format of npm commands.

For more details, you can refer the npm doc - https://docs.npmjs.com/cli/npm

Sign up to request clarification or add additional context in comments.

Comments

0

Use "heroku-postbuild": "echo Skip builds on Heroku"

This fixed my problem!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.