Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying to Heroku #49

Closed
Maor-RZ opened this issue Oct 7, 2017 · 3 comments
Closed

Deploying to Heroku #49

Maor-RZ opened this issue Oct 7, 2017 · 3 comments

Comments

@Maor-RZ
Copy link

Maor-RZ commented Oct 7, 2017

Hi!
I am trying to deploy my new reactJS app to heroku and it gives me the same error (below), whether I try to deploy via your special button or using Heroku CLI.
Can you please spot the problem and guid towards the solution?

thank you!
Maor.

The error:
-----> 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.6.0
engines.npm (package.json): 3.10.3

   Resolving node version 6.6.0...
   Downloading and installing node 6.6.0...
   npm 3.10.3 already installed with node

-----> Restoring cache
Skipping cache restore (not-found)
-----> Building dependencies
Installing node modules (package.json)

   > uglifyjs-webpack-plugin@0.4.6 postinstall /tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201/node_modules/uglifyjs-webpack-plugin
   > node lib/post_install.js
   
   
   > app@1.0.0 postinstall /tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201
   > npm run build
   
   
   > app@1.0.0 build /tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201
   > cross-env NODE_ENV=production webpack --config ./webpack.production.js --progress --profile --colors
   
   sh: 1: cross-env: not found
   
   npm ERR! Linux 3.13.0-128-generic
   npm ERR! argv "/tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201/.heroku/node/bin/node" "/tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201/.heroku/node/bin/npm" "run" "build"
   npm ERR! node v6.6.0
   npm ERR! npm  v3.10.3
   npm ERR! file sh
   npm ERR! code ELIFECYCLE
   npm ERR! errno ENOENT
   npm ERR! syscall spawn
   npm ERR! app@1.0.0 build: `cross-env NODE_ENV=production webpack --config ./webpack.production.js --progress --profile --colors`
   npm ERR! spawn ENOENT
   npm ERR!
   npm ERR! Failed at the app@1.0.0 build script 'cross-env NODE_ENV=production webpack --config ./webpack.production.js --progress --profile --colors'.
   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 app package,
   npm ERR! not with npm itself.
   npm ERR! Tell the author that this fails on your system:
   npm ERR!     cross-env NODE_ENV=production webpack --config ./webpack.production.js --progress --profile --colors
   npm ERR! You can get information on how to open an issue for this project with:
   npm ERR!     npm bugs app
   npm ERR! Or if that isn't available, you can get their info via:
   npm ERR!     npm owner ls app
   npm ERR! There is likely additional logging output above.
   
   npm ERR! Please include the following file with any support request:
   npm ERR!     /tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201/npm-debug.log
   
   npm ERR! Linux 3.13.0-128-generic
   npm ERR! argv "/tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201/.heroku/node/bin/node" "/tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201/.npmrc"
   npm ERR! node v6.6.0
   npm ERR! npm  v3.10.3
   npm ERR! code ELIFECYCLE
   npm ERR! app@1.0.0 postinstall: `npm run build`
   npm ERR! Exit status 1
   npm ERR!
   npm ERR! Failed at the app@1.0.0 postinstall script 'npm run 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 app package,
   npm ERR! not with npm itself.
   npm ERR! Tell the author that this fails on your system:
   npm ERR!     npm run build
   npm ERR! You can get information on how to open an issue for this project with:
   npm ERR!     npm bugs app
   npm ERR! Or if that isn't available, you can get their info via:
   npm ERR!     npm owner ls app
   npm ERR! There is likely additional logging output above.
   
   npm ERR! Please include the following file with any support request:
   npm ERR!     /tmp/build_5a6aa8c4af3adcb0c9f629797d1ac421/werein-react-b41b201/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
   
   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

@jirikolarik
Copy link
Member

Hi, thanks for using this repo.

There is problem with cross-env, quick fix is to remove cross-env from build command.

In package.json find this line
"build": "cross-env NODE_ENV=production webpack --config ./webpack.production.js --progress --profile --colors"

and remove cross-env
"build": "NODE_ENV=production webpack --config ./webpack.production.js --progress --profile --colors"

I'll try find a permanent solution for both windows & linux users

@pratikgaloria
Copy link

pratikgaloria commented Jan 13, 2018

@jirikolarik
Hey so I think now there is a problem with engines too while deploying, and I guess it would be better to
remove them as well from package.json.

jirikolarik pushed a commit that referenced this issue Feb 20, 2019
Removing engines from package.json

#49
@jirikolarik
Copy link
Member

After removing enginesit works just fine
https://werein-react-test.herokuapp.com/

YAfullStack added a commit to YAfullStack/React-project that referenced this issue Dec 4, 2021
Removing engines from package.json

werein/react#49
PrinceCharming0915 added a commit to PrinceCharming0915/react that referenced this issue Apr 14, 2022
Removing engines from package.json

werein/react#49
sperez927 pushed a commit to sperez927/react-heroku-app that referenced this issue Nov 11, 2023
Removing engines from package.json

werein/react#49
sperez927 added a commit to sperez927/react-heroku-app that referenced this issue Nov 30, 2023
Removing engines from package.json

werein/react#49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants