Paqmind / react-ultimate

React Ultimate Example
MIT License
303 stars 64 forks source link

Installation quirks #73

Closed tacone closed 9 years ago

tacone commented 9 years ago

Excuse me for opening a single issue, but these issues are trivial so I hope it's not a problem:

Dependancies the build fails because those deps are missing:

extract-text-webpack-plugin
assets-webpack-plugin
autoprefixer

Also the public folder seems to be missing and needs to be manually created.

Documentation correct commands for production:

npm run build
npm run node

Running

Running in dev mode works.

In production mode, it shows a 500 page and complains on the console about public/assets.json being missing.

$ npm run node 

> react-starter@0.1.0 node /home/tacone/Code/react/react-ultimate
> NODE_ENV=production NODE_CONFIG_DIR=shared/config babel-node backend/server.js

2015-06-14 10:48:57 ERROR Error: Cannot find module 'public/assets.json'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /home/tacone/Code/react/react-ultimate/backend/actions/common.js:14:20
    at Layer.handle [as handle_request] (/home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/layer.js:82:5)
    at next (/home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/route.js:110:13)
    at Route.dispatch (/home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/route.js:91:3)
    at Layer.handle [as handle_request] (/home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/layer.js:82:5)
    at /home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/index.js:267:22 
GET / 500 80.150 ms - -
2015-06-14 10:49:00 ERROR Error: Cannot find module 'public/assets.json'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /home/tacone/Code/react/react-ultimate/backend/actions/common.js:14:20
    at Layer.handle [as handle_request] (/home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/layer.js:82:5)
    at next (/home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/route.js:110:13)
    at Route.dispatch (/home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/route.js:91:3)
    at Layer.handle [as handle_request] (/home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/layer.js:82:5)
    at /home/tacone/Code/react/react-ultimate/node_modules/express/lib/router/index.js:267:22 
GET / 500 17.066 ms - -
ivan-kleshnin commented 9 years ago

Also the public folder seems to be missing and needs to be manually created.

In production mode, it shows a 500 page and complains on the console about public/assets.json being missing.

Thank you, I'll take a look. Others are fixed now :smile:

ivan-kleshnin commented 9 years ago

Also the public folder seems to be missing and needs to be manually created.

Added to install process.

In production mode, it shows a 500 page and complains on the console about public/assets.json being missing.

You need to run first $ npm run build which produces this file.

Thank you again for this catch ups.

tacone commented 9 years ago

I run it indeed, but the error persists.

I traced it down on line 14 of backend/actions/common.js. Changing

let assets = require("public/assets.json");

to:

let assets = require("../../public/assets.json");

will fix it. I'm not sending a pull request on this one, since I know you use absolute imports and I did not understand how it works precisely.

Also, even if then it runs, the css file is totally, so I guess you should revise a little bit your building process.

I think you're onto something with this repository, I like the ideas overall, and wish you good luck with it.

ivan-kleshnin commented 9 years ago

I run it indeed, but the error persists.

You didn't mention if assets.js was created in your case. I guess it did so you can easily workaround it manually. If absolute import does not work - first place to check is a symlink. Symlinks are created in bin/install and link to public is really missed from there.

So you need to run this command from the project root.

ln -s ../public  node_modules/public

I will fix this one of course. [Fixed]

I know you use absolute imports and I did not understand how it works precisely.

I can explain. 1) Absolute imports are easier to read and to support (practical experience in JS and Python) 2) NPM can use absolute imports only for folders / files located in node_modules 3) We can create an illusion of any project folder being located there through UNIX symlinks. This solution and this project are incompatible with Windows as a consequence (actually symlinks can be added in Windows but that is a different question "how"). 4) It makes sense to limit yourself to the top-level entry-like folders like frontend, backend etc. in my case. 5) The only thing to check for are name collisions. Our project folders we symlink should not be named as one of our NPM dependencies (babel, webpack... etc). 6) Symlinks are created at install step which must be rerunned if you removed entry folder or symlink manually. Install step must also be rerunned if you use ES6 syntax in webpack or tests and reinstall webpack or mocha.

tacone commented 9 years ago

Yes it was created.

Thank you for the explainations.