werein / react

Extremely simple boilerplate, easiest you can find, for React application including all the necessary tools: Flow | React 16 | redux | babel 6 | webpack 3 | css-modules | jest | enzyme | express + optional: sass/scss

Home Page:https://wereinhq.com/guides/react

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploying to Heroku

Maor-RZ opened this issue · comments

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

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

@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.

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