dvdzkwsk / react-redux-starter-kit

Get started with React, Redux, and React-Router.
MIT License
10.29k stars 2.21k forks source link

HOST=[host] NODE_ENV=production npm run depoy gives error #571

Closed hophacker closed 8 years ago

hophacker commented 8 years ago
npm ERR! Linux 3.13.0-32-generic
npm ERR! argv "/root/.nvm/versions/node/v5.6.0/bin/node" "/root/.nvm/versions/node/v5.6.0/bin/npm" "run" "compile"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! react-redux-starter-kit@1.0.0 compile: `babel-node bin/compile`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-redux-starter-kit@1.0.0 compile script 'babel-node bin/compile'.
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 react-redux-starter-kit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel-node bin/compile
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs react-redux-starter-kit
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls react-redux-starter-kit
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/No.497-H5-yuejian/npm-debug.log

npm ERR! Linux 3.13.0-32-generic
npm ERR! argv "/root/.nvm/versions/node/v5.6.0/bin/node" "/root/.nvm/versions/node/v5.6.0/bin/npm" "run" "deploy"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! react-redux-starter-kit@1.0.0 deploy: `better-npm-run deploy`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-redux-starter-kit@1.0.0 deploy script 'better-npm-run deploy'.
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 react-redux-starter-kit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     better-npm-run deploy
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs react-redux-starter-kit
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls react-redux-starter-kit
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/No.497-H5-yuejian/npm-debug.log
dvdzkwsk commented 8 years ago

Could you please post your npm-debug.log? Will try to repro, but difficult to tell right off the bat.

dvdzkwsk commented 8 years ago

I haven't been able to reproduce this, do you have any additional information about this error?

hophacker commented 8 years ago

Sorry for my late replay, it is here: npm-debug.txt

DonovanCharpin commented 8 years ago

Exactly the same error on my side.

hophacker commented 8 years ago

@Donovan-Ensicaen The most weird thing to me is that this is a transitional issue. It never happened in my desktop, but it bothers me on the server side SOMETIMES, all with the same code base, running the same command, which is npm run deploy

DonovanCharpin commented 8 years ago

@hophacker I use npm run deploy on local and I always have the error. I can't figure out the issue.

DonovanCharpin commented 8 years ago

Ok it works on my side, I can run npm run deploy. Be careful to remove all compiling errors as indentation, semicolons etc. Even if it compile, I'm not able to deploy it on heroku...

codetony25 commented 8 years ago

Having the same issue here. Not able to deploy on heroku.

hophacker commented 8 years ago

It seems that you need to clear all the errors output showing on "npm run dev" to ensure it works in production mode. But I think it's unnecessary since some errors generated by flow are "wrong" errors.

On Mon, Feb 29, 2016 at 1:33 PM, Tony Tai Nguyen notifications@github.com wrote:

Having the same issue here. Not able to deploy on heroku.

— Reply to this email directly or view it on GitHub https://github.com/davezuko/react-redux-starter-kit/issues/571#issuecomment-190052885 .

冯杰 排忧网络技术有限责任公司 苏州工业园区星湖街328号创意产业园

Cell: 86-15862355582 Linkedin: https://www.linkedin.com/pub/jie-feng/7a/a2a/194

Prev: Comprehend Systems, 2010 Broadway #200, Redwood City, CA 94063 Education: The Johns Hopkins University, Master of Science

dvdzkwsk commented 8 years ago

I might try deploying it myself to heroku today to see if I can repro.

DonovanCharpin commented 8 years ago

Thanks @davezuko. I tried to just git pull / build / deploy and it was not working on my side.

romanenko commented 8 years ago

I have the same issue when I try to deploy on heroku or a private VPS server on CentOS. Locally (OSX El Capitan) both npm run compile and NODE_ENV=production npm run compile runs and finishes successfully.

Same npm ERR! code ELIFECYCLE error pointing to at EventEmitter.<anonymous> (... /node_modules/npm/lib/utils/lifecycle.js:232:16). Looks very similar to #350, but I'm sure I have the latest node (5.7.0) and npm (3.7.5) and npm cache clear doesn't help.

romanenko commented 8 years ago

Here is the excerpt from my npm-debug.log:

[429] ./~/redux-form/lib/events/isEvent.js 237 bytes {1} [built]
[430] ./~/redux-form/lib/events/silenceEvent.js 453 bytes {1} [built]
[431] ./~/redux-form/lib/getDisplayName.js 206 bytes {1} [built]
[432] ./~/redux-form/lib/getValues.js 1.62 kB {1} [built]
[433] ./~/redux-form/lib/getValuesFromState.js 1.15 kB {1
npm verb lifecycle my-app@0.1.0~compile: unsafe-perm in lifecycle true
npm verb lifecycle my-app@0.1.0~compile: PATH: /tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/lib/node_modules/npm/bin/node-gyp-bin:/tmp/build_81c895bc33520498d87f9abc614abd7c/node_modules/.bin:/tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/bin:/tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/lib/node_modules/npm/bin/node-gyp-bin:/tmp/build_81c895bc33520498d87f9abc614abd7c/node_modules/.bin:/tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/bin:/tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/bin:/app/bin:/app/vendor/bundle/bin:/app/vendor/bundle/ruby/2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin
npm verb lifecycle my-app@0.1.0~compile: CWD: /tmp/build_81c895bc33520498d87f9abc614abd7c
npm info lifecycle my-app@0.1.0~compile: Failed to exec compile script
npm verb stack Error: my-app@0.1.0 compile: `better-npm-run compile`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
npm verb stack     at emitTwo (events.js:100:13)
npm verb stack     at EventEmitter.emit (events.js:185:7)
npm verb stack     at ChildProcess.<anonymous> (/tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/lib/node_modules/npm/lib/utils/spawn.js:24:14)
npm verb stack     at emitTwo (events.js:100:13)
npm verb stack     at ChildProcess.emit (events.js:185:7)
npm verb stack     at maybeClose (internal/child_process.js:827:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
npm verb pkgid my-app@0.1.0
npm verb cwd /tmp/build_81c895bc33520498d87f9abc614abd7c
npm ERR! Linux 3.13.0-77-generic
npm ERR! argv "/tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/bin/node" "/tmp/build_81c895bc33520498d87f9abc614abd7c/.heroku/node/bin/npm" "run" "compile"
npm ERR! node v5.7.0
npm ERR! npm  v3.7.5
npm ERR! code ELIFECYCLE
npm ERR! my-app@0.1.0 compile: `better-npm-run compile`
npm ERR! Exit status 1
npm ERR!

My app is based on this (awesome! :) ) starter-kit and all the main important config files left almost untouched.

romanenko commented 8 years ago

I figured out what caused this error. I did rm -rf node_modules, then npm cache clear and then npm install --production.

After that, when I ran npm run compile error was shown, that redux-devtools-dock-monitor and redux-devtools-log-monitor was missing. So I've moved them to dependencies section in package.json and the error is gone! Yay!

However I had to add eslint-config-standard-jsx to dependencies also, as well as I had to change server/main.js a bit to make production server start without errors:

    // ...
    // ------------------------------------
    // Apply Webpack HMR Middleware
    // ------------------------------------
    if (config.env === 'development') {
      const webpackDevMiddleware = require('./middleware/webpack-dev').default
      const webpackHMRMiddleware = require('./middleware/webpack-hmr').default
      const compiler = webpack(webpackConfig)

      // Enable webpack-dev and webpack-hot middleware
      const { publicPath } = webpackConfig.output

      app.use(webpackDevMiddleware(compiler, publicPath))
      app.use(webpackHMRMiddleware(compiler))

    // ...
dvdzkwsk commented 8 years ago

Thanks for the info @romanenko, I will make those changes in master later.

DonovanCharpin commented 8 years ago

Oh thanks @romanenko ! Not easy to catch. I hope I will be able to deploy on heroku after this fix :)

dvdzkwsk commented 8 years ago

Going to close this for now since the issue is actually tangential as @romanenko has figured out (production-only dependencies) and has a bigger scope (improved error reporting). I will be creating a more formal issue to tackle this once I return from vacation.