Push rejected, failed to compile Node.js app - node.js

I have mean stack node js app , I am trying to deploy it to heroku , unfortunatelly I am getting the following message.
remote: Installing any new modules (package.json)
remote: npm ERR! code EINVALIDTAGNAME
remote: npm ERR! Invalid tag name "^6.0.0.beta.1": Tags may not have any characters that encodeURIComponent encodes.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.3UQhB/_logs/2018-07-08T09_19_13_394Z-debug.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: Some possible problems:
remote:
remote: - node_modules checked into source control
remote: https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to proexebookingapp.
remote:
To https://git.heroku.com/proexebookingapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/proexebookingapp.git'
C:\Users\Bonge\Documents\Projects\bookinga
pp>
here is my package.json file
{
"name": "movies-database",
"version": "1.0.0",
"description": "a simple movie database Rest API",
"main": "index.js",
"scripts": {
"dev": "nodemon server.js"
},
"keywords": [],
"author": "Geofrey Julius Zellah",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.3",
"bootstrap": "^3.3.7",
"connect-flash": "^0.1.1",
"cors": "^2.8.4",
"express": "^4.16.3",
"jquery": "^3.3.1",
"mongodb": "^2.2.33",
"mongoose": "^5.1.5",
"node-rest-client": "^3.1.0",
"nodemon": "^1.17.5",
"request": "^2.87.0",
"winston": "^3.0.0",
"primeng": "^6.0.0.beta.1",
"primeicons": "^1.0.0-beta.6"
}
}
I tried different method from google but nothing helped, maybe some knows this problem in heroku deployment environment,
Please can some one help me on this?any help suggestion will be appreciated.

^6.0.0.beta.1 isn't a valid semantic version, this is what error message says.
As semantic versioning spec states,
A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes. Pre-release versions have a lower precedence than the associated normal version. A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.
There's already a proper beta version next to primeng,
"primeicons": "^1.0.0-beta.6"
It should be:
"primeng": "^6.0.0-beta.1",

Related

Nodejs: failed to push some refs to 'https://git.heroku.com/myproject.git'

I made a portfolio with Reactjs and a little bit of nodejs to implement nodemailer, and now I'm trying to deploy to heroku but I'm getting this error: ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/dedaportfolio.git
I'm trying everthing but it seems nothing working, I did a lot of research around but nothing worked to me
Here is the error when I'm trying to push to heroku
Enumerating objects: 38099, done.
Counting objects: 100% (38099/38099), done.
Delta compression using up to 8 threads
Compressing objects: 100% (28232/28232), done.
Writing objects: 100% (38099/38099), 98.10 MiB | 108.00 KiB/s, done.
Total 38099 (delta 8542), reused 38081 (delta 8535), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 16.15.0
remote: engines.npm (package.json): 7.24.2
remote:
remote: Resolving node version 16.15.0...
remote: Downloading and installing node 16.15.0...
remote: Bootstrapping npm 7.24.2 (replacing 8.5.5)...
remote: npm 7.24.2 installed
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json)
remote:
remote: added 89 packages, and audited 90 packages in 8s
remote:
remote: 12 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: 1 critical severity vulnerability
remote:
remote: To address all issues (including breaking changes), run:
remote: npm audit fix --force
remote:
remote: Run `npm audit` for details.
remote:
remote: -----> Build
remote: Detected both "build" and "heroku-postbuild" scripts
remote: Running heroku-postbuild
remote:
remote: > myportfolio#1.0.0 heroku-postbuild
remote: > cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build
remote:
remote:
remote: up to date, audited 1466 packages in 3s
remote:
remote: 194 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: 7 high severity vulnerabilities
remote:
remote: To address issues that do not require attention, run:
remote: npm audit fix
remote:
remote: To address all issues (including breaking changes), run:
remote: npm audit fix --force
remote:
remote: Run `npm audit` for details.
remote:
remote: added 64 packages, removed 188 packages, changed 281 packages, and audited 1342 packages in 27s
remote:
remote: 207 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: 6 high severity vulnerabilities
remote:
remote: To address all issues (including breaking changes), run:
remote: npm audit fix --force
remote:
remote: Run `npm audit` for details.
remote:
remote: > frontend#0.1.0 build
remote: > react-scripts build
remote:
remote: sh: 1: react-scripts: Permission denied
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to dedaportfolio.
remote:
To https://git.heroku.com/dedaportfolio.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/dedaportfolio.git'
this the package.json in the root of my project
{
"name": "myportfolio",
"version": "1.0.0",
"engines": {
"node": "16.15.0",
"npm":"7.24.2"
},
"description": "",
"main": "index.js",
"scripts": {
"client": "cd client && npm start",
"server": "nodemon server.js",
"build": "cd client && npm run build",
"dev":"concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"",
"start": "node server.js",
"heroku-postbuild": "cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"nodemailer": "^4.7.0"
},
"devDependencies": {
"concurrently": "^7.3.0"
}
}
This is my client package.json
{
"name": "client",
"version": "0.1.0",
"engines": {
"node": "16.15.0"
},
"private": true,
"dependencies": {
"#fortawesome/free-brands-svg-icons": "^6.1.2",
"#fortawesome/free-solid-svg-icons": "^6.1.2",
"#fortawesome/react-fontawesome": "^0.2.0",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"bootstrap": "^5.2.0",
"framer-motion": "^7.0.0",
"react": "^18.2.0",
"react-bootstrap": "^2.4.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"react-scripts": "^5.0.1",
"react-scroll": "^1.8.7",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
The final three messages here:
To https://git.heroku.com/dedaportfolio.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/dedaportfolio.git'
are from Git itself and are simply a summary of the fact that Heroku (not Git) didn't like your code. Ignore them entirely as they add no information whatsoever; pay attention only to the remote:-prefixed lines. Git relays these lines to you whenever Heroku tells you why it does not like your code.
The remaining problems are all specific to either Heroku or your code. In this case, the errors come from npm, which is noting:
high severity vulnerabilities
which you should fix because security vulnerabilities are bad, but most importantly, from the next step in the build process:
sh: 1: react-scripts: Permission denied
which simply means that your react-scripts in the stuff you're deploying is wrong, so have a look at that.

Heroku Next JS app push rejected because of Node version

When trying to push my app to Heroku I am getting the following errors (edited for brevity):
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): >=v12.22.5
remote: engines.npm (package.json): >=6.14.14
remote:
remote: Resolving node version >=v12.22.5...
remote: Could not parse Version Requirements '>=v12.22.5': the given version requirement is invalid
remote: Downloading and installing node 17.0.1...
remote: Bootstrapping npm >=6.14.14 (replacing 8.1.0)...
remote: npm >=6.14.14 installed
My package.json (name redacted):
{
"name": "########",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p $PORT"
},
"engines": {
"node": "16.13.0"
},
"dependencies": {
"#stripe/react-stripe-js": "^1.4.1",
"#stripe/stripe-js": "^1.15.0",
"#zeit/next-css": "^1.0.0",
"axios": "^0.21.4",
"base-64": "^1.0.0",
"bootstrap": "^4.6.0",
"cookie": "^0.4.1",
"date-and-time": "^1.0.0",
"js-cookie": "^2.2.1",
"next": "^11.1.2",
"react": "17.0.2",
"react-bootstrap": "^1.5.2",
"react-calendar": "^3.3.1",
"react-datepicker": "^4.2.1",
"react-dom": "17.0.2",
"react-hook-form": "^7.17.4",
"react-icons": "^4.2.0",
"react-image-gallery": "^1.0.9",
"stripe": "^8.154.0"
}
}
... and further down the error trail:
remote: Error: error:0308010C:digital envelope routines::unsupported
remote: at new Hash (node:internal/crypto/hash:67:19)
remote: at Object.createHash (node:crypto:130:10)
remote: at BulkUpdateDecorator.hashFactory (/tmp/build_f62151d1/node_modules/next/dist/compiled/webpack/bundle5.js:138971:18)
remote: at BulkUpdateDecorator.update (/tmp/build_f62151d1/node_modules/next/dist/compiled/webpack/bundle5.js:138872:50)
remote: at /tmp/build_f62151d1/node_modules/next/dist/compiled/webpack/bundle5.js:59321:9
remote: at processTicksAndRejections (node:internal/process/task_queues:83:21)
remote: at runNextTicks (node:internal/process/task_queues:65:3)
remote: at processImmediate (node:internal/timers:437:9) {
remote: opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
remote: library: 'digital envelope routines',
remote: reason: 'unsupported',
remote: code: 'ERR_OSSL_EVP_UNSUPPORTED'
remote: }
remote: Node.js v17.0.1
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: Some possible problems:
remote:
remote: - Dangerous semver range (>) in engines.node
And, at the end of the error messages, I'm not sure if this is a separate error. I changed my master branch to main a while back and I'm not sure if this is also telling me that I may have done this incorrectly (seems fine on GitHub):
remote: Verifying deploy...
remote:
remote: ! Push rejected to #########.
remote:
To https://git.heroku.com/########.git
! [remote rejected] main -> main (pre-receive hook declined)
I have been 'around the houses' on Google trying various and many fixes with no answer that worked. It looks to me as if Heroku is reading the wrong information from my package.json? Many thanks for any replies.
Got some help from Heroku support for this. My problem seemed to match a current use case that's currently out there online but I don't think this is the same. In case anyone else has the same issue I'll put my solutions here.
Heroku build was trying to automatically install version 17 of Node because it didn't understand the 'engines' version I had in my package.json at that time, and Heroku build is not compatible with version 17.x
The version of package.json 'stuck' in Heroku's build
"engines": {
"node": ">=v12.22.5"
},
But I changed that version multiple times during tesing and it seems Heroku didn't notice the changes to package.json. Heroku support told me to run a cache clearance and that worked. Once I ran the cache clearance Heroku build then picked up the correct version of Node from the 'engines' element. Here's how to clear the build cache
Install heroku-builds from the Heroku CLI
heroku plugins:install heroku-builds
Ensure the correct version of Node is on your local machine, but more importantly make sure the correct version is referenced in package.json. I decided on version 16.13.0
"engines": {
"node": "16.13.0"
},
Run the Heroku cache clearance
heroku builds:cache:purge -a example-app
Then redeploy your app. In my case the issue was fixed. Not sure if Heroku agree (and I'm not qualified to argue) but I feel the error in the end was because the cache needed to be cleared.
References:
Clear the build cache:
https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache
Supported Node versions:
https://devcenter.heroku.com/articles/nodejs-support#supported-runtimes

MERN app fails to run "heroku-postbuild" script while being deployed to Heroku

Everything runs just fine until I try to deploy the app to the Heroku. After logging in, these are the terminal commands I run to deploy the app (and the response):
heroku login
heroku: Press any key to open up the browser to login or q to exit:
Logging in... done
Logged in as #hidden
heroku create
Creating app... done, ⬢ lower-donair-61893
https://lower-donair-61893.herokuapp.com/ | https://git.heroku.com/lower-donair-61893.git
git init
Initialized empty Git repository in #hidden
heroku git:remote -a lower-donair-61893
git add .
warning: adding embedded git repository: client
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached client
hint:
hint: See "git help submodule" for more information.
warning: LF will be replaced by CRLF in package-lock.json.
The file will have its original line endings in your working directory
git commit -am "make it better"
[master (root-commit) cdaf621] make it better
13 files changed, 2518 insertions(+)
create mode 100644 .gitignore
create mode 160000 client
create mode 100644 config/default.json
create mode 100644 models/Comment.js
create mode 100644 models/Post.js
create mode 100644 models/User.js
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 routes/api/auth.js
create mode 100644 routes/api/posts.js
create mode 100644 routes/api/users.js
create mode 100644 server.js
The "fun" starts when I run the last command:
git push heroku master
Enumerating objects: 19, done.
Counting objects: 100% (19/19), done.
Delta compression using up to 8 threads
Compressing objects: 100% (15/15), done.
Writing objects: 100% (19/19), 28.99 KiB | 1.61 MiB/s, done.
Total 19 (delta 3), reused 0 (delta 0), pack-reused 0
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.2...
remote: Using default npm version: 6.14.5
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote:
remote: > nodemon#2.0.4 postinstall /tmp/build_01ff90de74651f20444f369d014096d8/node_modules/nodemon
remote: > node bin/postinstall || exit 0
remote:
remote: Love nodemon? You can now support the project via the open collective:
remote: > https://opencollective.com/nodemon/donate
remote:
remote: added 267 packages from 151 contributors and audited 268 packages in 9.402s
remote:
remote: 12 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Build
remote: Running heroku-postbuild
remote:
remote: > heroku-postbuild /tmp/build_01ff90de74651f20444f369d014096d8
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote: up to date in 0.219s
remote: found 0 vulnerabilities
remote:
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_01ff90de74651f20444f369d014096d8/client/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build_01ff90de74651f20444f369d014096d8/client/package.json'
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.0iNHH/_logs/2020-07-01T13_46_53_504Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 254
remote: npm ERR! heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
remote: npm ERR! Exit status 254
remote: npm ERR!
remote: npm ERR! Failed at the heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.0iNHH/_logs/2020-07-01T13_46_53_520Z-debug.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to lower-donair-61893.
remote:
To https://git.heroku.com/lower-donair-61893.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/lower-donair-61893.git'
So it's an ENOENT, yet I searched for other MERN apps being deployed to Heroku and found this vid:
https://www.youtube.com/watch?v=71wSzpLyW9k&list=PLillGF-RfqbbiTGgA77tGO426V3hRF9iE&index=8
in which he used the same lines of code as I did. Also my app is a "continue" of his series, so the file structures, scripts etc. are the exact same (that means if you navigate to the video's desc, you can see the link to the github repo, which has a lot less, but the key files such as package.json etc. are cloned).
This is the postbuild script I'm trying to run:
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
This is a screenshot of my file structure:
file structure
I've been searching for an answer for past 4 hours and found absolutely nothing. The error messages point out this path, but I can't really find it to review the full log.
/tmp/npmcache.0iNHH/_logs/2020-07-01T13_46_53_504Z-debug.log
Please, if you need to see more, tell me and I'll happily provide whatever you need - for now I'll copy all the code in both package.json files (server and client):
Server one:
{
"name": "#hidden",
"version": "1.0.0",
"description": "#hidden",
"main": "server.js",
"scripts": {
"client-install": "npm install --prefix client",
"start": "node server",
"server": "nodemon server",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"keywords": [
#hidden
],
"author": "#hidden",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"concurrently": "^5.2.0",
"config": "^3.3.1",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.9.19"
},
"devDependencies": {
"nodemon": "^2.0.4"
}
}
Client one:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.3.2",
"#testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"bootstrap": "^4.5.0",
"moment": "^2.27.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-moment": "^0.9.7",
"react-redux": "^7.2.0",
"react-router-dom": "^5.2.0",
"react-router-redux": "^4.0.8",
"react-scripts": "3.4.1",
"react-transition-group": "^4.4.1",
"reactstrap": "^8.4.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"proxy": "http://localhost:5000"
}
I managed to solve this and successfuly deploy the app by removing all the default gitignore exceptions inside my client folder. I don't know why, but there was "/build" included. My final client gitignore file only includes:
/node_modules
if it is heroku postbuild issue then first run
npm run build
in your local system inside client folder(frontend application), it will throw an error if some dependency is missing inside your react app,
if build command is successful only then delete node_modules and package-lock.json file and then run
npm install
Check to have the correct commands in the package.json. For me I had the following setup command wrong.
"heroku-postbuild": "npm install && npm run build"
Try to read all errors because they are usually very clear and indicate exactly which command failed at which line.

Can't deploy React app to Heroku due to webpack

I'm trying to deploy a react app (not Create-react-app), which consist of my own webpack configurations. I can Build the app successfully locally and running locally successfully. But when I push to Heroku, git push heroku master I get the following message:
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: NPM_CONFIG_PRODUCTION=true
remote: YARN_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=false
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 10.x
remote: engines.npm (package.json): unspecified (use default)
remote: engines.yarn (package.json): 1.x
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.16.0...
remote: Using default npm version: 6.9.0
remote: Resolving yarn version 1.x...
remote: Downloading and installing yarn (1.16.0)...
remote: Installed yarn 1.16.0
remote:
remote: -----> Restoring cache
remote: Caching has been disabled because NODE_MODULES_CACHE=false
remote:
remote: -----> Installing dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v1.16.0
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents#1.2.9: The platform "linux" is incompatible with this module.
remote: info "fsevents#1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: [4/4] Building fresh packages...
remote: Done in 18.83s.
remote:
remote: -----> Build
remote: Running build (yarn)
remote: yarn run v1.16.0
remote: $ rm -rf build/ && webpack --env.mode production
remote:
remote: Insufficient number of arguments or no entry found.
remote: Alternatively, run 'webpack(-cli) --help' for usage info.
remote:
remote: Hash: 9809f658cd5ff48864d7
remote: Version: webpack 4.33.0
remote: Time: 555ms
remote: Built at: 06/12/2019 9:16:13 PM
remote:
remote: ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in '/tmp/build_429e145805178d81754292048e646eab'
remote: Child html-webpack-plugin for "index.html":
remote: 1 asset
remote: Entrypoint undefined = index.html
remote: [0] ./node_modules/html-webpack-plugin/lib/loader.js!./public/index.html 1.9 KiB {0} [built]
remote: [2] (webpack)/buildin/global.js 472 bytes {0} [built]
remote: [3] (webpack)/buildin/module.js 497 bytes {0} [built]
remote: + 1 hidden module
remote: error Command failed with exit code 2.
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to react-go-fullstack.
remote:
This is my package.json:
{
"name": "fullstack-course",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "rm -rf build/ && webpack-dev-server --env.mode development --hot",
"build": "rm -rf build/ && webpack --env.mode production"
},
"engines": {
"node": "10.x",
"yarn": "1.x"
},
"repository": {
"type": "git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/NaseebullahSafi/fullstack-course/issues"
},
"devDependencies": {
"#babel/cli": "^7.2.3",
"#babel/core": "^7.4.0",
"#babel/preset-env": "^7.4.2",
"#babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.6",
"babel-plugin-styled-components": "^1.10.0",
"clean-webpack-plugin": "^2.0.1",
"css-loader": "^2.1.1",
"style-loader": "^0.23.1"
},
"dependencies": {
"copy-webpack-plugin": "^5.0.3",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.7.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"prop-types": "^15.7.2",
"react": "^16.8.5",
"react-dom": "^16.8.6",
"react-hot-loader": "^4.8.0",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"resources-manifest-webpack-plugin": "^3.0.0",
"styled-components": "^4.2.0",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.4",
"webpack-dev-server": "^3.2.1",
"webpack-merge": "^4.2.1"
}
}
Can someone please explain what the issue is, and how can one resolve it.
Thanks

Error while deploying Angular App (NodeJS) to Heroku

I currently develop an angular5 app, and need to deploy it to Heroku.
This app is served using NodeJS.
After logging into Heroku, I create new app by:
heroku create angular-vbnmc
and it was successful, now i could open https://angular-vbnmc.herokuapp.com/ without problems, but still the content is blank, see picture below:
Then i deploy my app with following commands
git push heroku newFeatureBranch:master
Note: I didn't push my master branch but instead i push newFeatureBranch to remote heroku's master branch
and I got following error
Counting objects: 219, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (208/208), done.
Writing objects: 100% (219/219), 122.63 KiB | 3.50 MiB/s, done.
Total 219 (delta 111), reused 0 (delta 0)
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_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 8.9.4
remote: engines.npm (package.json): 5.6.0
remote:
remote: Resolving node version 8.9.4...
remote: Downloading and installing node 8.9.4...
remote: npm 5.6.0 already installed with node
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (not-found)
remote:
remote: -----> Building dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote: bootstrap#4.0.0 /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/bootstrap
remote: Installing any new modules (package.json)
remote:
remote: > uws#0.14.5 install /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/uws
remote: > node-gyp rebuild > build_log.txt 2>&1 || exit 0
remote:
remote:
remote: > node-sass#4.7.2 install /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.7.2/linux-x64-57_binding.node
remote: Download complete
remote: Binary saved to /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/node-sass/vendor/linux-x64-57/binding.node
remote: Caching binary to /tmp/npmcache.ShxWb/node-sass/4.7.2/linux-x64-57_binding.node
remote:
remote: > uglifyjs-webpack-plugin#0.4.6 postinstall /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
remote: > node lib/post_install.js
remote:
remote:
remote: > node-sass#4.7.2 postinstall /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/node-sass/vendor/linux-x64-57/binding.node
remote: Testing binary
remote: Binary is fine
remote:
remote: > angular-vbnmc#0.0.0 postinstall /tmp/build_61c2abaea4d9525f4aeb3f08e81769a2
remote: > ng build --prod
remote:
remote:
remote: An error occured during the build:
remote: Error: ENOENT: no such file or directory, open '/tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/bootstrap/dist/js/bootstrap.min.js'
remote: ENOENT: no such file or directory, open '/tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/bootstrap/dist/js/bootstrap.min.js'
remote: Error: ENOENT: no such file or directory, open '/tmp/build_61c2abaea4d9525f4aeb3f08e81769a2/node_modules/bootstrap/dist/js/bootstrap.min.js'
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! angular-vbnmc#0.0.0 postinstall: `ng build --prod`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the angular-vbnmc#0.0.0 postinstall script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.ShxWb/_logs/2018-03-06T04_54_08_334Z-debug.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: Some possible problems:
remote:
remote: - node_modules checked into source control
remote: https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to angular-vbnmc.
remote:
To https://git.heroku.com/angular-vbnmc.git
! [remote rejected] 12-Deployment -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/angular-vbnmc.git'
For additional information, here is my package.json:
{
"name": "angular-vbnmc",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "ng build --prod"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.2.7",
"#angular/cli": "1.6.6",
"#angular/common": "^5.2.7",
"#angular/compiler": "^5.2.7",
"#angular/compiler-cli": "^5.2.7",
"#angular/core": "^5.2.7",
"#angular/forms": "^5.2.7",
"#angular/http": "^5.2.7",
"#angular/platform-browser": "^5.2.7",
"#angular/platform-browser-dynamic": "^5.2.7",
"#angular/router": "^5.2.7",
"bootstrap": "^4.0.0",
"core-js": "^2.4.1",
"express": "^4.16.2",
"jquery": "^3.3.1",
"popper.js": "^1.13.0",
"rxjs": "^5.5.6",
"typescript": "^2.6.2",
"zone.js": "^0.8.19"
},
"devDependencies": {
"#angular/language-service": "^5.2.7",
"#types/jasmine": "~2.8.3",
"#types/jasminewd2": "~2.0.2",
"#types/node": "^6.0.101",
"codelyzer": "^4.2.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "5.8.0"
},
"engines": {
"node": "8.9.4",
"npm": "5.6.0"
}
}
Why is this happening? and how to fix this error?

Resources