Deploying an app on heroku and the build succeeds but when I try to open it I get "application error" and it tells me to check the logs.
The logs:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.16.3...
Using default npm version: 6.14.4
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules
added 0 packages in 0.033s
-----> Build
-----> Caching build
- node_modules (nothing to cache)
-----> Pruning devDependencies
up to date in 0.219s
found 0 vulnerabilities
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 22.2M
-----> Launching...
Released v6
https://cbcv.herokuapp.com/ deployed to Heroku
Any ideas as to what I'm missing?
Please provide the logs after the build is succeeded. You've given the logs while the app was being deployed. To view the recent logs you can use heroku logs --tail.
Related
Trying to get Heroku to use cached modules for Yarn v3 using workspaces. I have the following:
package.json:
"engines": {
"node": "16.x",
"yarn": "3.x"
},
"cacheDirectories": [
"node_modules",
"packages/components/node_modules",
"packages/lib/node_modules",
"packages/schema/node_modules",
"packages/web/node_modules",
"packages/web/.next/cache"
]
heroku-buildpack-features:
cache-native-yarn-cache=true
Heroku output:
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
USE_YARN_CACHE=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
! You don't need to specify Yarn engine. Heroku will install the latest Yarn 1.x, so that per project version can be used. More information here: https://yarnpkg.com/getting-started/install#global-install
https://devcenter.heroku.com/articles/nodejs-support
engines.node (package.json): 16.x
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): unspecified (use default)
Resolving node version 16.x...
Downloading and installing node 16.7.0...
Using default npm version: 7.20.3
Resolving yarn version 1.22.x...
Downloading and installing yarn (1.22.11)
Using yarn 3.0.0
-----> Installing binaries
! You don't need to specify Yarn engine. Heroku will install the latest Yarn 1.x, so that per project version can be used. More information here: https://yarnpkg.com/getting-started/install#global-install
https://devcenter.heroku.com/articles/nodejs-support
engines.node (package.json): 16.x
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): unspecified (use default)
Resolving node version 16.x...
Downloading and installing node 16.7.0...
Using default npm version: 7.20.3
Resolving yarn version 1.22.x...
Downloading and installing yarn (1.22.11)
Using yarn 3.0.0
-----> Restoring cache
Loading 6 from cacheDirectories (package.json):
- node_modules
- packages/components/node_modules (not cached - skipping)
- packages/lib/node_modules
- packages/schema/node_modules
- packages/web/node_modules
- packages/web/.next/cache
<a bunch of resolve stuff>
➤ YN0000: ┌ Fetch step
➤ YN0013: │ #apollo/client#npm:3.4.7 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ #apollo/protobufjs#npm:1.2.2 can't be found in the cache and will be fetched from the remote registry
<and so on>
I've tried adding ".yarn/cache" to cacheDirectories in package.json, but it always says it's empty.
Not really sure where to go from here.
As of 9/2/2021, Heroku's nodeJS buildback doesn't fully support yarn 2. They started adding support in v173, but caching hasn't been fully addressed yet.
The underlying issue is that the buildpack doesn't properly detect that $BUILD_DIR/.yarn/cache exists and sets the environment variable YARN_CACHE_FOLDER to something other than .yarn/cache.(see
https://github.com/heroku/heroku-buildpack-nodejs/blob/752f1d5a139a800920cf5bb1bf70aad1a2954525/bin/compile#L140)
When the buildpack gets to the cache step the .yarn/cache directory doesn't actually exist.
The solution:
I was able to work around this by manually setting YARN_CACHE_FOLDER to .yarn/cache in the config vars. You can do this via the CLI by running heroku config:set YARN_CACHE_FOLDER=.yarn/cache.
Ensure you also have .yarn/cache listed in cacheDirectories.
You will know it works when the build logs show:
-----> Caching build
Saving 1 cacheDirectories (package.json):
- .yarn/cache
If it did not work there would be a (nothing to cache) note next to .yarn/cache.
I have deployed my app from git to Heroku successfully and I enabled automatic deployment that worked fine.
Somewhere in the past 2 weeks the deployment has started failing each time for the same reason, even though there's no problem with the code in the git - it's running fine.
You can see in the log file that it mentions each time:
" Creating an optimized production build...
Failed to compile.
./src/App.js
Cannot find file './pages/MainPage' in './src'.
But the MainPage file is right where it should be and the app is compiling and running locally.
I've tried disconnecting and reconnecting from git and heroku,
I've deleted and re-installed the node modules and the package-lock,
and I cache clean --force.
I don't know what went wrong, any suggestions?
Thank you!
-----> React.js (create-react-app) multi app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-multi.git
=====> Detected Framework: Multipack
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
=====> Detected Framework: Node.js
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.20.0...
Using default npm version: 6.14.8
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules
> core-js#2.6.12 postinstall /tmp/build_826a0ec4_/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> fsevents#1.2.13 install /tmp/build_826a0ec4_/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> fsevents#1.2.13 install /tmp/build_826a0ec4_/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> core-js#3.8.0 postinstall /tmp/build_826a0ec4_/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> fsevents#1.2.13 install /tmp/build_826a0ec4_/node_modules/jest-haste-map/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> core-js-pure#3.8.0 postinstall /tmp/build_826a0ec4_/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
added 1695 packages in 29.379s
-----> Build
Running build
> rosenflix#0.1.0 build /tmp/build_826a0ec4_
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/App.js
Cannot find file './pages/MainPage' in './src'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rosenflix#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rosenflix#0.1.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! /tmp/npmcache.Zqszt/_logs/2020-12-02T21_16_51_485Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile React.js (create-react-app) multi app.
! Push failed
Your production build may be referencing a relative import that for some reason does not exist. Reconfigure that import using ${__dirname}/path_to_file and try again.
Here is a link of how to use it.
Hope this works for you.
I'm new to Heroku
I have been trying to deploy my app to Heroku but I'm having an issue which I can't resolve
My build passes and the app gets deployed but there is an error which I can't find nor resolve
I'm not really sure where to look nor what to look for since I'm literally too new to Heroku
Here is my build log
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.x
engines.npm (package.json): 6.x
Resolving node version 12.x...
Downloading and installing node 12.18.3
Bootstrapping npm 6.x (replacing 6.14.6)...
npm 6.x installed
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules
added 39 packages in 1.246s
-----> Build
-----> Caching build
- node_modules
-----> Pruning devDependencies
audited 39 packages in 0.584s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 23.4M
-----> Launching...
Released v5
https://ferit-virtual-classroom.herokuapp.com/ deployed to Heroku
And here is my package.json
{
"name": "ferit-bot",
"version": "1.0.0",
"description": "",
"publishConfig": { "registry": "https://npm.pkg.github.com/" },
"author": "JaVolimKatarinu",
"license": "ISC",
"dependencies": {
"discord.js": "^12.1.1",
"mysql2": "^2.1.0",
"node-fetch-npm": "^2.0.4"
},
"engines":{
"node": "12.x",
"npm": "6.x"
},
"scripts": {
"start": "main.js"
}
}
I have searched for a potential answer on Heroku support but without any luck
Thank you for reading and I would be really glad for a helpful answer
EDIT:All good, I have managed to deploy the app and its working
Thanks for help
The scripts in package-json file is not properly setup.
There must always be a start command which can be anything to be run in the terminal, but for yours, the script should be
"scripts": {
"start": "node main.js"
}
node keyword is ignored, thats why?
did you add a Procfile ?
web: node main.js
I'm getting
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
when I try to push to Heroku , this is not a first push I have this app deployed in Heroku already, but all of a sudden Heroku started throwing this error.
I have tried
setting git config --global http.postBuffer 524288000
restarting all dynos
deleting Heroku project and creating it again.
tried pushing same repo to GitHub and it works fine.
I'm using macos-catalina
here is the complete error
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 12.x...
remote: Downloading and installing node 12.18.3
remote: Using default npm version: 6.14.6
remote:
remote: -----> Restoring cache
remote: - node_modules
remote:
remote: -----> Installing dependencies
remote: Installing node modules
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
any help would be appreciated. thanks
In case any one is facing similar issues , check Heroku logs , in my case next.js build was taking too much memory so the deploy was getting rejected, eventhough push was success.
Build successfully but still getting internal server error.
Please help to fix this, build message is given below:-
-----> 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): 10.6.0
engines.npm (package.json): unspecified (use default)
Resolving node version 10.6.0...
Downloading and installing node 10.6.0...
Using default npm version: 6.1.0
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (package.json + package-lock)
audited 492 packages in 2.222s
found 0 vulnerabilities -----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Pruning devDependencies
removed 66 packages and audited 355 packages in 2.11s
found 0 vulnerabilities
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 22.6M
-----> Launching...
Released v14
https://young-forest-74580.herokuapp.com/ deployed to Heroku