judo-heroes-2
judo-heroes-2 copied to clipboard
How do I host this on a server? I can't find the index.html after running build.
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?
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 😉
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 > [email protected]: 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:
> [email protected] start:universal /app
> export UNIVERSAL=true && npm run start
> [email protected] start /app
> npm run build && node src/server-es5.js
> [email protected] 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! [email protected] build: `NODE_ENV=production webpack -p --profile --display-modules --optimize-minimize`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] 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! [email protected] start: `npm run build && node src/server-es5.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! [email protected] start:universal: `export UNIVERSAL=true && npm run start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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!!!
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