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

How do I host this on a server? I can't find the index.html after running build. #18

Open
davidfufu opened this issue Jun 6, 2018 · 3 comments

Comments

@davidfufu
Copy link

The build commands don't create a build directory with an index.html. I'm stuck. I was wondering if the static folder was the build folder. It has the bundle.js file, but i don't see any html files? Can anyone shed some light on this?

@davidfufu davidfufu changed the title How do I host this on a server? How do I host this on a server? I can't find the index.html after running build. Jun 6, 2018
@lmammino
Copy link
Owner

lmammino commented Jun 6, 2018

Hello @davidfufu,
to run this on a server, you will need to have node/npm installed and then run:

npm run start:universal

Let me know if this helps you 😉

@davidfufu
Copy link
Author

So, I took a shot at hosting it on heroku.
I got the log files from the initial install.

-----> Node.js app detected
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)
       engines.yarn (package.json):  unspecified (use default)
       
       Resolving node version 8.x...
       Downloading and installing node 8.11.2...
       Using default npm version: 5.6.0
       Resolving yarn version 1.x...
       Downloading and installing yarn (1.7.0)...
       Installed yarn 1.7.0
-----> Restoring cache
       Skipping cache restore (not-found)
-----> Building dependencies
       Installing node modules (yarn.lock)
       yarn install v1.7.0
       [1/4] Resolving packages...
       warning snyk > proxy-agent > socks-proxy-agent > socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
       error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.
       info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
-----> Build failed
 !     Outdated Yarn lockfile
       Your application contains a Yarn lockfile (yarn.lock) which does not
       match the dependencies in package.json. This can happen if you use npm
       to install or update a dependency instead of Yarn.
       Please run the following command in your application directory and check
       in the new yarn.lock file:
       $ yarn install
       $ git add yarn.lock
       $ git commit -m "Updated Yarn lockfile"
       $ git push heroku master
    
       https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-an-outdated-yarn-lockfile
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

So I see it's a problem with the yarn.lock file, and I take the following steps:
1.I fork your repo
2. clone it on my pc and run "yarn install"
3. I commit and push the new yarn.lock changes onto my forked rep
4. i create the heroku app and choose github as the deployment method
5. I link my forked repo and it says the deployment was successful
6. I click view app, and all I get is the error

Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.

When I inspect the webpage, the console has one error:

Failed to load resource: the server responded with a status of 503 (Service Unavailable)

Then, I go to the heroku console and type in npm run start:universal and get the following error:


> judo-heroes-2@1.0.0 start:universal /app
> export UNIVERSAL=true && npm run start


> judo-heroes-2@1.0.0 start /app
> npm run build && node src/server-es5.js


> judo-heroes-2@1.0.0 build /app
> NODE_ENV=production webpack -p --profile --display-modules --optimize-minimize

sh: 1: webpack: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! judo-heroes-2@1.0.0 build: `NODE_ENV=production webpack -p --profile --display-modules --optimize-minimize`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the judo-heroes-2@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /app/.npm/_logs/2018-06-06T20_43_09_639Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! judo-heroes-2@1.0.0 start: `npm run build && node src/server-es5.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the judo-heroes-2@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /app/.npm/_logs/2018-06-06T20_43_09_686Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! judo-heroes-2@1.0.0 start:universal: `export UNIVERSAL=true && npm run start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the judo-heroes-2@1.0.0 start:universal script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /app/.npm/_logs/2018-06-06T20_43_09_724Z-debug.log

Help me out bro!!!

@lmammino
Copy link
Owner

Sorry for the late reply.
It seems you have two problems here. an outdated yarn file and missing webpack in your heroku build pack. Not sure how to address both at the moment, but i am sure you can find something online.

Regarding yarn, i am sure if you just delete the yarn lock and re run yarn that should fix the issue. Regarding webpack there must be some webpack enabled build pack for heroku

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