Heroku deployment is failing even though app is running - heroku

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.

Related

Hi. I created Quasar App - Website. Trying to push it to Heroku and it says Push fail. Providing console with error

I'm trying to push my git to Heroku but it gives an error right at the end. I had a look on console of deploying a project as I understand warnings are not a big deal for crashing the whole app. As I went through console I notice that critical error is
quasar: not found
error Command failed with exit code 127.
As far as I think is something wrong with npm or yarn package but don't really know what exactly. I specified in json file same version of node what I have and same version of npm what I have on my computer. I don't use yarn, could that be an issue ?
Here is my json
{
"name": "portfolio",
"version": "0.0.1",
"description": "A Quasar Framework app",
"productName": "Eldar Tailov",
"author": "'Eldar' <'tailov47#gmail.com'>",
"private": true,
"scripts": {
"build": "quasar build",
"start": "node server.js",
"heroku-postbuild": "yarn && yarn build"
},
"dependencies": {
"#quasar/extras": "^1.0.0",
"axios": "^0.20.0",
"connect-history-api-fallback": "^1.6.0",
"core-js": "^3.6.5",
"express": "^4.17.1",
"quasar": "^1.0.0",
"serve-static": "^1.14.1",
"vue2-google-maps": "^0.10.7"
},
"devDependencies": {
"#quasar/app": "^2.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-vue": "^6.1.2",
"workbox-webpack-plugin": "^5.1.4"
},
"browserslist": [
"last 10 Chrome versions",
"last 10 Firefox versions",
"last 4 Edge versions",
"last 7 Safari versions",
"last 8 Android versions",
"last 8 ChromeAndroid versions",
"last 8 FirefoxAndroid versions",
"last 10 iOS versions",
"last 5 Opera versions"
],
"engines": {
"node": "~12.18.2",
"npm": "~6.14.5",
"yarn": ">= 1.21.1"
}
}
and here is a log of heroku
-----> 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.18.2
engines.npm (package.json): ~6.14.5
engines.yarn (package.json): >= 1.21.1
Resolving node version ~12.18.2...
Downloading and installing node 12.18.4...
Bootstrapping npm ~6.14.5 (replacing 6.14.6)...
npm ~6.14.5 installed
Resolving yarn version >= 1.21.1...
Downloading and installing yarn (1.22.5)
Installed yarn 1.22.5
-----> Installing dependencies
Installing node modules
> core-js#3.6.5 postinstall /tmp/build_bc8b4d0e_/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> fsevents#1.2.13 install /tmp/build_bc8b4d0e_/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> ejs#2.7.4 postinstall /tmp/build_bc8b4d0e_/node_modules/ejs
> node ./postinstall.js
> fsevents#1.2.13 install /tmp/build_bc8b4d0e_/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> node-sass#4.14.1 install /tmp/build_bc8b4d0e_/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
Download complete
Binary saved to /tmp/build_bc8b4d0e_/node_modules/node-sass/vendor/linux-x64-72/binding.node
Caching binary to /tmp/npmcache.XZGoT/_cacache/node-sass/4.14.1/linux-x64-72_binding.node
> node-sass#4.14.1 postinstall /tmp/build_bc8b4d0e_/node_modules/node-sass
> node scripts/build.js
Binary found at /tmp/build_bc8b4d0e_/node_modules/node-sass/vendor/linux-x64-72/binding.node
Testing binary
Binary is fine
> core-js#2.6.11 postinstall /tmp/build_bc8b4d0e_/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
added 1590 packages in 23.801s
-----> Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild
> portfolio#0.0.1 heroku-postbuild /tmp/build_bc8b4d0e_
> yarn && yarn build
yarn install v1.22.5
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning vue2-google-maps > babel-runtime > core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
warning #quasar/app > webpack-dev-server > chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning #quasar/app > webpack-dev-server > chokidar > fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning #quasar/app > node-sass > request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning #quasar/app > node-sass > node-gyp > request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning #quasar/app > node-sass > request > har-validator#5.1.5: this library is no longer supported
warning #quasar/app > webpack > watchpack > watchpack-chokidar2 > chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning #quasar/app > stylus > css-parse > css > urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
warning #quasar/app > webpack-dev-server > chokidar > braces > snapdragon > source-map-resolve > urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
warning #quasar/app > webpack-dev-server > chokidar > braces > snapdragon > source-map-resolve > resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
warning eslint-loader#3.0.4: This loader has been deprecated. Please use eslint-webpack-plugin
warning workbox-webpack-plugin > workbox-build > rollup-plugin-babel#4.4.0: This package has been deprecated and is no longer maintained. Please use #rollup/plugin-babel.
warning workbox-webpack-plugin > workbox-build > #hapi/joi#15.1.1: joi is leaving the #hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411)
warning workbox-webpack-plugin > workbox-build > #hapi/joi > #hapi/address#2.1.4: This version has been deprecated and is no longer supported or maintained
warning workbox-webpack-plugin > workbox-build > #hapi/joi > #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
warning workbox-webpack-plugin > workbox-build > #hapi/joi > #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
warning workbox-webpack-plugin > workbox-build > #hapi/joi > #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
warning workbox-webpack-plugin > workbox-build > #hapi/joi > #hapi/topo > #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
[3/5] Fetching packages...
info fsevents#2.1.3: The platform "linux" is incompatible with this module.
info "fsevents#2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents#1.2.13: The platform "linux" is incompatible with this module.
info "fsevents#1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > eslint-loader#3.0.4" has unmet peer dependency "webpack#^4.0.0 || ^5.0.0".
warning " > workbox-webpack-plugin#5.1.4" has unmet peer dependency "webpack#^4.0.0".
[5/5] Building fresh packages...
success Saved lockfile.
Done in 45.19s.
yarn run v1.22.5
$ quasar build
/bin/sh: 1: quasar: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! portfolio#0.0.1 heroku-postbuild: `yarn && yarn build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the portfolio#0.0.1 heroku-postbuild 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.XZGoT/_logs/2020-09-28T01_01_55_709Z-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
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
I faced exactly the same issue as you did. I was able to fix it from the suggestions in this link. I think it's because the #quasar/app was listed in the dev dependencies.
https://devcenter.heroku.com/articles/nodejs-support#heroku-specific-build-steps
Basically, I updated the engine part of package.json to match my local env
"engines": {
"node": ">= 12.18.3",
"npm": ">= 6.14.11",
"yarn": ">= 1.22.5"
}
and then set the YARN_PRODUCTION env variable on heroku to false
heroku config:set YARN_PRODUCTION=false
I hope you'll find this useful (P.S. Of course don't set a static value in the engine part, use wildcard instead)
Quasar is probably not installed globally on heroku,
try to run it using npx:
"scripts": {
...
"build": "npx quasar build -m ssr",
"start": "cd dist/ssr; npm i; npm start"
}

Application error when trying to deploy heroku app

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.

"Missing list of packages to add to your project" error while install Heroku deploy plugin

I want deploy my JHipster application to Heroku, but when I run command "jhipster heroku", I received the following error:
Installing Heroku CLI deployment plugin
× { Error: Command failed: heroku plugins:install heroku-cli-deploy --force
Installing plugin java... yarn add v1.12.3
Installing plugin java... [1/4] Resolving packages...Installing plugin java... [2/4] Fetching packages...Installing plugin java... [3/4] Linking dependencies...Installing plugin java... [4/4] Building fresh packages...Installing plugin java... success Saved 1 n
ew dependency.Installing plugin java... info Direct dependenciesInstalling plugin java... └─ #heroku-cli/plugin-java#3.0.1Installing plugin java... Done in 2.97s.Installing plugin java... installed v3.0.1
Installing plugin --force... yarn add v1.12.3
Installing plugin --force... info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.Installing plugin --force... !
error Missing list of packages to add to your project.
Error: yarn add --force#latest --non-interactive --mutex=file:C:/Users/start/AppData/Local/heroku/yarn.lock --preferred-cache-folder=C:/Users/start/AppData/Local/heroku/yarn --check-files --registry=https://registry.npmjs.org exited with code 1
at ChildProcess.forked.on (C:/Program Files/heroku/client/node_modules/#oclif/plugin-plugins/lib/yarn.js:31:28)
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
killed: false,
code: 1,
signal: null,
cmd: 'heroku plugins:install heroku-cli-deploy --force' }
Versions of tools:
JHipster: 5.1.0
Heroku: heroku/7.19.4 win32-x64 node-v11.3.0
Yarn: 1.7.0
Node: v8.10.0
I've already tried out the following commands:
heroku plugins:install java - successfully installed
heroku plugins:install heroku-cli-deploy --force -
Then an error occurs:
Installing plugin java... installed v3.0.1
error Missing list of packages to add to your project.
Installing plugin --force... !
Error: yarn add --force#latest --non-interactive --mutex=file:C:/Users/start/AppData/Local/heroku/yarn.lock --preferred-cache-folder=C:/Users/start/AppData/Local/heroku/yarn --check-files --registry=https://registry.npmjs.org exited with code 1
at ChildProcess.forked.on (C:/Program Files/heroku/client/node_modules/#oclif/plugin-plugins/lib/yarn.js:31:28)

Why is my npm install failing on Mac for React Native?

New to React Native I've made sure to install node.js from here and after install I'm told:
Node.js v9.5.0 to /usr/local/bin/node
npm v5.6.0 to /usr/local/bin/npm
I can verify the node version:
node --version: v9.5.0
I ran the documentation's getting started for npm install:
npm install -g create-react-native-app
and also referenced building projects and installed watchman with brew:
watchman 4.9.0
in the terminal ran: npm install -g react-native-cli and terminal: npm start and I get:
grim ~/react-native/react-native npm start
> react-native#1000.0.0 start /Users/grim/React-Native/react-native
> /usr/bin/env bash -c './scripts/packager.sh "$#" || true' --
module.js:557
throw err;
^
Error: Cannot find module 'graceful-fs'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/grim/React-Native/react-native/local-cli/cli.js:12:1)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
grim ~/react-native/react-native
After research I found NPM, cannot find 'graceful-fs', no matter what I do and in terminal ran:
sudo npm install -g graceful-fs
and get:
+ graceful-fs#4.1.11
added 1 package in 0.678s
but when I run npm install I get:
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/grim/.npm/_logs/2018-02-08T17_08_50_619Z-debug.log
and in the file log it shows:
116 error code EUNSUPPORTEDPROTOCOL
117 error Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
so I went to The Problem with gulp-util but when I do:
npm ls gulp-util
I get └── (empty).
Further research I found Why is my npm install not working? but that throws an npm ERR! What am I doing wrong and how can I get npm successfully installed on my Mac running Seirra?
What caused this was trying to test RNTester from the react native repo and it told me:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
Edit
Per the suggested answer already tried brew install node and was told with a warning node 9.5.0 is already installed so tried brew link node then prompted:
grim ~/react-native/react-native brew link node
Linking /usr/local/Cellar/node/9.5.0...
Error: Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
so ran brew link --overwrite node.
Edit
Browsing through my files under Users/grim I found a directory with modules in it named node_modules could that be in the wrong location?
Edit
After further research I found Fixing npm On Mac OS X for Homebrew Users and ran:
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
modified my ~/.bash_profile with nano:
export PATH="$HOME/.npm-packages/bin:$PATH"
ran npm install and received a missing package.json file so in the terminal did npm init and answered the questions. Went back and pointed to the cloned repo and when I run npm install:
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
but if I build a new project with react-native init AwesomeProject and npm install I get:
up to date in 0.416s
and I can point into the project and do react-native run-ios and it works but react-native run-android has to be tweaked in the build.bundle from: classpath 'com.android.tools.build:gradle:2.2.3' to classpath "com.android.tools.build:gradle:2.1.0"
Use Homebrew for Mac as package manager;
https://brew.sh/
then you can run: brew install node
There are many other utilities on this.
create-react-native app does not work with npm 5.
I had the same problem on Windows and downgraded my npm to 4 you can use npm i -g npm#4 to downgrade.
You may try to use yarn command with -W flag (or --ignore-workspace-root-check) which might be helpful.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Regards

Installing docpad#6.63 error: No compatible version found: taskgroup#'~3.3.7n'

I'm trying to install docpad and following the guide on: http://docpad.org/docs/install
When I issue the command:
npm install -g docpad#6.63
I get the following npm error:
npm ERR! Error: No compatible version found: taskgroup#'~3.3.7n'
npm ERR! Valid install targets:
npm ERR! ["2.0.0","3.0.0","3.1.0","3.1.1","3.1.2","3.2.0","3.2.2","3.2.3","3.2.4","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","3.3.7","3.3.8"]
My node version: v0.10.15
My npm version: 1.2.18
I'm running Kubuntu 13.10 with all updates.
I checked if there is an issue reported for this on github, there isn't. Should I report this as an issue or am I doing something wrong?
Same problem here (Kubuntu 13.10).
I sugggest to go back to a previous version of docpad for the moment. On Ubunto/Debian there is another pitfall: some node modules depend on the nodejs executable to be available under node, so you need the additional package nodejs-legacy.
This worked for me:
sudo apt-get install nodejs-legacy
npm install docpad#6.55.6
Bug on DocPad's behalf, that n shouldn't have been there. Now fixed in v6.63.5. Thanks for the report!

Resources