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

Running on Windows... everything installs find with mongo running #48

Closed
LarryEitel opened this issue Aug 6, 2015 · 7 comments
Closed

Comments

@LarryEitel
Copy link

I can run node run node server/index.js OK. I open http://localhost:3001/ and it renders Cannot GET /.

Your repo is the closest to what I am looking for to start my foray into reactjs.

I prefer to run on windows for the client app that will hit my Laravel API already setup for CORS.

I see a base.html in the app DIR. What am I missing here?

@choonkending
Copy link
Member

@LarryEitel Can you run npm run build and then run npm start. Then you can access http://localhost:3000 instead of 3001.

Let me know if that helps.

@LarryEitel
Copy link
Author

I hacked package.json to accommodate setting environment variables in Windows:

    "start": "set NODE_ENV=production && node server/index.js",
    "dev": "set NODE_ENV=development && npm run buildDev && node server/index.js",

It works now. Can't think of an elegant way to accommodate linux AND windows for setting environment variables in one line.

I am very happy to get you project running locally. Thank you for sharing!! :)

Do you intend to maintain this project along with your reap version? I am working with MySql so I will be exploring that project for ideas. :)

@LarryEitel
Copy link
Author

Moving on... I now run npm run watch / watchDev. Everything seems to initialize however nothing renders when I hit http://localhost:3000/.

This may be informative:

npm run watch

> react-webpack-node@1.1.5 watch F:\_vms\HomesteadCode\xapp
> webpack --watch --progress --config ./webpack/webpack.config.js

 69% 220/222 builHash: 8256dd13e9508875fafa
Version: webpack 1.11.0
Time: 4957ms
                               Asset     Size  Chunks             Chunk Names
3f1998aca65909c0bd077ca705e7d25c.png  6.88 kB          [emitted]
ddaf6d6ec871786ec6ee85b2869447b0.png  5.68 kB          [emitted]
751390a95ba609212014ff3c73ebf976.png  5.38 kB          [emitted]
                       app.server.js  88.3 kB       0  [emitted]  app
                    header.server.js  8.65 kB       1  [emitted]  header
                     styles/main.css  4.86 kB       0  [emitted]  app
    + 52 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Hash: e5a16b858b9f9794b4b1
Version: webpack 1.11.0
Time: 6327ms
              Asset     Size  Chunks             Chunk Names
             app.js  1.27 MB       0  [emitted]  app
    styles/main.css   4.9 kB       0  [emitted]  app
         app.js.map  1.49 MB       0  [emitted]  app
styles/main.css.map  12.2 kB       0  [emitted]  app
    + 251 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules

Chrome Network tab showed failed attempt to load localhost.

@choonkending
Copy link
Member

@LarryEitel

I am very happy to get you project running locally. Thank you for sharing!! :)

That made my day! Thanks! :)

Do you intend to maintain this project along with your reap version? I am working with MySql so I will be exploring that project for ideas. :)

I will be maintaining this project actively in my spare time. The reap version was more of a proof-of-concept for working with Postgresql. :)

Everything seems to initialize however nothing renders when I hit http://localhost:3000/

If you run npm run watch, you will still need to have another tab open running npm start for the server to start. npm run watch recompiles on any file changes, but does not restart the server.

If you want to try making changes with live reloads, you can just run npm run dev which starts the server and reloads your components as you save.

@LarryEitel
Copy link
Author

@choonkending SO CLOSE!!! In one tab I run npm run watchDev and another I run npm run dev. I hit http://localhost:3000/ and BADA BANG it works!!! However, when I make a change to code, although both tabs refresh/rerun their stuff, BADA BOOM!!!. Even if/when I manually refresh or it refreshes with LiveReload, the change is not reflected in the browse UNLESS I rerun npm run dev.

As you can imagine, that would be a very painful workflo... Kinda like the days when you had to recompile everything everytime you wanted to try something.

If you don't work on Windows, I can appreciate where this falls on your list of priorities.

Question: Is there any reason why this won't work on Windows? If it should work, I will run with any ideas/suggestions to work this out. Perhaps someone else tuning in may have an observation.

Thanks again. :)

@LarryEitel
Copy link
Author

Ok, got things to a workable state using gulp and LiveReload. Used this tutorial: Tutorial – How to use Livereload with Nodemon in Gulp to Automatically Reload your Browser and Restart your App

I ran: npm install --save-dev gulp gulp-livereload gulp-notify gulp-nodemon express (express can be excluded)

Here's my adapted gulpfile.js file:

// Dependencies
var gulp = require('gulp');
var nodemon = require('gulp-nodemon');
var notify = require('gulp-notify');
var livereload = require('gulp-livereload');

// Task
gulp.task('default', function() {
    // listen for changes
    livereload.listen();
    // configure nodemon
    nodemon({
        // the script to run the app
        script: 'server/index.js',
        ext: 'js'
    }).on('restart', function(){
        // when the app has restarted, run livereload.
        gulp.src('server/index.js')
            .pipe(livereload())
            .pipe(notify('Reloading page, please wait...'));
    })
})

So with LiveReload watching my app AND public directory and enabled, in one tab I run npm run watch and in another tab I run gulp. Browse to localhost:3000. Make a change to code like in app/base.html, save and watch browser reload with change reflected.

This is in production mode. So next will be to try in dev mode to get sourceMaps.

@choonkending
Copy link
Member

@LarryEitel Sorry it took months (literally) to get back on this. Let me know if you still need help with the current version of the repo. Closing for now. :)

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

2 participants