How to solve the Error in deploying react app on Heroku - node.js

I run yarn install and yarn start locally for my project and it works fine. However, as soon as I push it to Heroku, I am unable to deploy it with the following error log:
2021-05-10T16:40:06.622555+00:00 app[web.1]: > react-scripts start
2021-05-10T16:40:06.622556+00:00 app[web.1]:
2021-05-10T16:40:06.627252+00:00 app[web.1]: sh: 1: react-scripts: not found
2021-05-10T16:40:06.636894+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-05-10T16:40:06.637303+00:00 app[web.1]: npm ERR! syscall spawn
2021-05-10T16:40:06.637496+00:00 app[web.1]: npm ERR! file sh
2021-05-10T16:40:06.637766+00:00 app[web.1]: npm ERR! errno ENOENT
2021-05-10T16:40:06.644457+00:00 app[web.1]: npm ERR! bleh#0.1.0 start: `react-scripts start`
2021-05-10T16:40:06.644627+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-05-10T16:40:06.644771+00:00 app[web.1]: npm ERR!
2021-05-10T16:40:06.644922+00:00 app[web.1]: npm ERR! Failed at the bleh#0.1.0 start script.
2021-05-10T16:40:06.645043+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-05-10T16:40:06.654910+00:00 app[web.1]:
2021-05-10T16:40:06.655128+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-05-10T16:40:06.655306+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-05-10T16_40_06_646Z-debug.log
2021-05-10T16:40:06.706089+00:00 heroku[web.1]: Process exited with status 1
2021-05-10T16:40:06.778374+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-10T16:41:26.103511+00:00 app[api]: Deploy 1f4ec645 by user holliu9999#gmail.com
2021-05-10T16:41:26.103511+00:00 app[api]: Release v7 created by user holliu9999#gmail.com
2021-05-10T16:41:26.390448+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-10T16:41:30.000000+00:00 app[api]: Build succeeded
2021-05-10T16:41:32.398941+00:00 heroku[web.1]: Starting process with command `npm start`
In addition, I do only contain the yarn.lock in my directory so I am confused why it still runing npm. And here is my package.json file:
{
"name": "bleh",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "0.9.0"
},
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-fontawesome": "^1.6.1",
"react-infinite": "^0.11.2",
"react-infinite-loader": "^1.0.2",
"react-router": "^3.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}

You need to have a back-end server like node with express and config the script npm start. Go to Package.json --> scripts --> and add the script --> "start": "node app or index" depend of your root file. Btw you need to put the react application on the public folder of your backend.
Heroku needs a backend to start correctly.
You can see the express setup https://www.npmjs.com/package/express or http://expressjs.com/en/starter/hello-world.html

Related

Error says "Could not find a required file. Name: index.js"

I'm trying to deploy my backend server into heroku but each time I do it, I keep getting an application error. And when I went to the log to check what went wrong, my git says it cannot find index.js.
I tried to fix it by moving my index.js into a public folder and changing my main entry point from index.js to public/index.js in my package.json, but it still wouldn't find the file. What is it I am doing wrong?
Here is the error I am getting
2021-04-15T20:19:14.000000+00:00 app[api]: Build succeeded
2021-04-15T20:19:18.661041+00:00 heroku[web.1]: Starting process with command `npm start`
2021-04-15T20:19:22.775555+00:00 app[web.1]:
2021-04-15T20:19:22.775583+00:00 app[web.1]: > server#1.0.0 start /app
2021-04-15T20:19:22.775584+00:00 app[web.1]: > react-scripts start
2021-04-15T20:19:22.775584+00:00 app[web.1]:
2021-04-15T20:19:25.621087+00:00 app[web.1]: Could not find a required file.
2021-04-15T20:19:25.621968+00:00 app[web.1]: Name: index.js
2021-04-15T20:19:25.622086+00:00 app[web.1]: Searched in: /app/src
2021-04-15T20:19:25.646722+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-04-15T20:19:25.647156+00:00 app[web.1]: npm ERR! errno 1
2021-04-15T20:19:25.655186+00:00 app[web.1]: npm ERR! server#1.0.0 start: `react-scripts start`
2021-04-15T20:19:25.655413+00:00 app[web.1]: npm ERR! Exit status 1
2021-04-15T20:19:25.655603+00:00 app[web.1]: npm ERR!
2021-04-15T20:19:25.655751+00:00 app[web.1]: npm ERR! Failed at the server#1.0.0 start script.
2021-04-15T20:19:25.655898+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-04-15T20:19:25.664579+00:00 app[web.1]:
2021-04-15T20:19:25.664850+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-04-15T20:19:25.664960+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-04-15T20_19_25_656Z-debug.log
2021-04-15T20:19:25.726536+00:00 heroku[web.1]: Process exited with status 1
2021-04-15T20:19:25.802980+00:00 heroku[web.1]: State changed from starting to crashed
here's my package.json file
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"axios": "^0.21.1",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"mysql": "^2.18.1",
"react": "^17.0.2",
"react-scripts": "^4.0.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "react-scripts start"
},
"keywords": [],
"author": "",
"license": "ISC"
}

Heroku npm start starts from different location

I have a fully functional NodeJs application with a submodule bundled inside it, so the submodule is the main application, and the other node project is built upon it.
I would like to run the submodule (the inner application) from the outer application. It might sound strange, but this is really what I would like to achieve.
It works fine when I run it in a local environment, but I can not make it work on Heroku.
Locally I run it with the command: heroku local web
My Procfile: web: npm run startwithouteslint
My outer package.json:
{
"name": "chatgine-pension",
"version": "1.0.0",
"description": "Chatgine-pension application",
"engines": {
"node": "10.x"
},
"main": "chatiety-engine/index.js",
"scripts": {
"startwithouteslint": "npm run startwithouteslint --prefix chatiety-engine",
"start": "eslint \"**/*.js\" && npm start --prefix chatiety-engine",
"test": "eslint \"**/*.js\" && mocha test --recursive --exit",
"coverage": "eslint \"**/*.js\" && nyc --reporter=text mocha test --recursive --exit"
},
"dependencies": {},
"devDependencies": {},
"repository": {},
"keywords": [],
"license": "custom"
}
My inner package.json (inside chatiety-engine folder):
{
"name": "chatiety-engine",
"version": "1.0.0",
"description": "Chatiety-engine application",
"engines": {
"node": "10.x"
},
"main": "index.js",
"scripts": {
"startwithouteslint": "node index.js",
"start": "eslint \"**/*.js\" && node index.js",
"test": "eslint \"**/*.js\" && mocha test --recursive --exit",
"coverage": "eslint \"**/*.js\" && nyc --reporter=text mocha test --recursive --exit"
},
"dependencies": {},
"devDependencies": {},
"repository": {},
"keywords": [],
"license": "custom"
}
Structure of the project:
The error message from Heroku:
2019-11-25T16:43:45.727225+00:00 heroku[web.1]: Starting process with command `npm run startwithouteslint`
2019-11-25T16:43:48.223968+00:00 app[web.1]:
2019-11-25T16:43:48.223991+00:00 app[web.1]: > chatgine-pension#1.0.0 startwithouteslint /app
2019-11-25T16:43:48.223993+00:00 app[web.1]: > npm run startwithouteslint --prefix chatiety-engine
2019-11-25T16:43:48.223995+00:00 app[web.1]:
2019-11-25T16:43:48.559728+00:00 app[web.1]: npm ERR! code ENOENT
2019-11-25T16:43:48.560276+00:00 app[web.1]: npm ERR! syscall open
2019-11-25T16:43:48.560632+00:00 app[web.1]: npm ERR! path /app/chatiety-engine/package.json
2019-11-25T16:43:48.563785+00:00 app[web.1]: npm ERR! errno -2
2019-11-25T16:43:48.563789+00:00 app[web.1]: npm ERR! enoent ENOENT: no such file or directory, open '/app/chatiety-engine/package.json'
2019-11-25T16:43:48.563792+00:00 app[web.1]: npm ERR! enoent This is related to npm not being able to find a file.
2019-11-25T16:43:48.563793+00:00 app[web.1]: npm ERR! enoent
2019-11-25T16:43:48.570839+00:00 app[web.1]:
2019-11-25T16:43:48.571073+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-11-25T16:43:48.571158+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-11-25T16_43_48_563Z-debug.log
2019-11-25T16:43:48.578800+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-11-25T16:43:48.579173+00:00 app[web.1]: npm ERR! errno 254
2019-11-25T16:43:48.580465+00:00 app[web.1]: npm ERR! chatgine-pension#1.0.0 startwithouteslint: `npm run startwithouteslint --prefix chatiety-engine`
2019-11-25T16:43:48.580626+00:00 app[web.1]: npm ERR! Exit status 254
2019-11-25T16:43:48.580875+00:00 app[web.1]: npm ERR!
2019-11-25T16:43:48.581043+00:00 app[web.1]: npm ERR! Failed at the chatgine-pension#1.0.0 startwithouteslint script.
2019-11-25T16:43:48.581209+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-11-25T16:43:48.587148+00:00 app[web.1]:
2019-11-25T16:43:48.587357+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-11-25T16:43:48.587493+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-11-25T16_43_48_581Z-debug.log
2019-11-25T16:43:48.666923+00:00 heroku[web.1]: State changed from starting to crashed
2019-11-25T16:43:48.642599+00:00 heroku[web.1]: Process exited with status 254
It seems like Heroku appends the /app at the beginning of the path but I have no idea why, and where could I turn it off.
EDIT: I was able to list all the environment variables used by Heroku, and two of those are very likely to cause the problem:
PWD=/app
HOME=/app
So far so good, but I can not override these env. variables. Do you have any idea how could I achieve this?
Thanks for any help in advance!
I was having the same problem. Just realize that my code was crashing. You have to fix the bug on your code, then this message "npm run startwithouteslint" will disappear. You can run "npm run start" in your terminal and some clues of your errors it will be on the screen.

Heroku node.js app runs locally but crashes remotely

I have a node.js application which is not a web application.
Here's my package.json:
{
"name": "myapp-backend",
"version": "1.0.0",
"description": "MyApp PubNub backend",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.heroku.com/myapp.git"
},
"keywords": [
"backend"
],
"author": "Pete Gu",
"license": "ISC",
"dependencies": {
"pubnub": "^4.3.3"
},
"engines": {
"node" : "6.9.2"
}
}
Contents of Procfile:
app: node app.js
It runs when I run heroku local. However, after pushing the code and checking logs with heroku logs I see this:
2016-12-22T06:07:01.276053+00:00 app[api]: Deploy fb193d3 by user xxxxx#xxxx.com
2016-12-22T06:07:01.477131+00:00 heroku[slug-compiler]: Slug compilation started
2016-12-22T06:07:01.477136+00:00 heroku[slug-compiler]: Slug compilation finished
2016-12-22T06:07:01.276053+00:00 app[api]: Release v13 created by user gpeetonn#gmail.com
2016-12-22T06:07:01.507095+00:00 heroku[web.1]: State changed from crashed to starting
2016-12-22T06:07:02.759643+00:00 heroku[web.1]: Starting process with command `npm start`
2016-12-22T06:07:06.003266+00:00 heroku[web.1]: Process exited with status 1
2016-12-22T06:07:06.016232+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-22T06:07:06.017114+00:00 heroku[web.1]: State changed from crashed to starting
2016-12-22T06:07:05.872484+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic
2016-12-22T06:07:05.872909+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-12-22T06:07:05.873173+00:00 app[web.1]: npm ERR! node v6.9.2
2016-12-22T06:07:05.873421+00:00 app[web.1]: npm ERR! npm v3.10.9
2016-12-22T06:07:05.877486+00:00 app[web.1]: npm ERR! missing script: start
2016-12-22T06:07:05.875800+00:00 app[web.1]:
2016-12-22T06:07:05.877738+00:00 app[web.1]: npm ERR!
2016-12-22T06:07:05.877884+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-12-22T06:07:05.878031+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-12-22T06:07:05.892349+00:00 app[web.1]:
2016-12-22T06:07:05.892997+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-12-22T06:07:05.892655+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-12-22T06:07:07.532860+00:00 heroku[web.1]: Starting process with command `npm start`
2016-12-22T06:07:10.603753+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic
2016-12-22T06:07:10.604065+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-12-22T06:07:10.604260+00:00 app[web.1]: npm ERR! node v6.9.2
2016-12-22T06:07:10.604476+00:00 app[web.1]: npm ERR! npm v3.10.9
2016-12-22T06:07:10.606525+00:00 app[web.1]:
2016-12-22T06:07:10.607621+00:00 app[web.1]: npm ERR! missing script: start
2016-12-22T06:07:10.607822+00:00 app[web.1]: npm ERR!
2016-12-22T06:07:10.607900+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-12-22T06:07:10.607998+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-12-22T06:07:10.618207+00:00 app[web.1]:
2016-12-22T06:07:10.618415+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-12-22T06:07:10.618645+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-12-22T06:07:10.718608+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-22T06:07:10.710362+00:00 heroku[web.1]: Process exited with status 1
...which completely doesn't make sense to me - why heroku tries to launch app using npm start instead of reading Procfile?
Heroku seems to be trying to start a web dyno, and doesn't seem to know about your Procfile.
Are you sure you added your Procfile to your git repo?
Anyway, try this:
heroku ps:scale web=0
heroku ps:scale app=1
You could also add "start": "node app.js" in the "scripts" section of your package.json.
I can see the error missing script: start So you need to add
"scripts": {
"start": "node bin/xxx" //your main file name
}
add this to your package.json.

Error while deploying NodeJs app on Heroku

I've tried to deploy my NodeJs app on Heroku, follows all steps on Heroku guide but I can't make it running. Here is the log:
2016-06-27T18:46:16.424477+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-27T18:46:18.594534+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-27T18:46:21.204182+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-27T18:46:21.205909+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-27T18:46:21.204971+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-27T18:46:21.209309+00:00 app[web.1]: npm ERR! missing script: start
2016-06-27T18:46:21.221679+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-27T18:46:21.209934+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-27T18:46:21.207755+00:00 app[web.1]:
2016-06-27T18:46:21.221362+00:00 app[web.1]:
2016-06-27T18:46:21.209552+00:00 app[web.1]: npm ERR!
2016-06-27T18:46:21.209740+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-27T18:46:21.221872+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-27T18:46:21.205374+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-27T18:46:22.240678+00:00 heroku[web.1]: Process exited with status 1
2016-06-27T18:46:22.255389+00:00 heroku[web.1]: State changed from starting to crashed
Any thoughts?
[EDIT]
package.json:
"engines": {
"node": "5.11.1",
"npm": "3.8.6"
},
"scripts": {
"start": "node app.js"
},
Procfile:
web: npm start
package.json
{
"name": "your-project-name",
"version": "1.0.0",
"description": "desc",
"main": "app.js",
"scripts": {
"start": "node app.js",
...
}
...
}
Procfile
Above package.json is file good to go without a Procfile. Yet, if you want to have one, you can define it as follows:
web: node app.js
You need to tell Heroku how to start your app. Either do that by specifying a "start" script in package.json, or by providing a Procfile.

package.json start script, babel-node: not found on heroku deploy

When I run heroku local or when I just do npm start locally, my app builds and runs fine. However when I deploy to heroku, the app crashes saying it cannot find babel-node.
Here is the log output:
2016-04-21T22:20:44.320025+00:00 heroku[api]: Deploy 5d9a9da by eagsalazar#gmail.com
2016-04-21T22:20:44.320084+00:00 heroku[api]: Release v9 created by eagsalazar#gmail.com
2016-04-21T22:20:44.542062+00:00 heroku[slug-compiler]: Slug compilation started
2016-04-21T22:20:44.542069+00:00 heroku[slug-compiler]: Slug compilation finished
2016-04-21T22:20:44.501025+00:00 heroku[web.1]: State changed from crashed to starting
2016-04-21T22:20:46.278065+00:00 heroku[web.1]: Starting process with command `npm start`
2016-04-21T22:20:50.467407+00:00 app[web.1]:
2016-04-21T22:20:50.467434+00:00 app[web.1]: > qc-server#1.0.0 start /app
2016-04-21T22:20:50.467435+00:00 app[web.1]: > babel-node index.js
2016-04-21T22:20:50.467436+00:00 app[web.1]:
2016-04-21T22:20:50.479490+00:00 app[web.1]: sh: 1: babel-node: not found
2016-04-21T22:20:50.521936+00:00 app[web.1]:
2016-04-21T22:20:50.538822+00:00 app[web.1]: npm ERR! Linux 3.13.0-79-generic
2016-04-21T22:20:50.539334+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-04-21T22:20:50.539595+00:00 app[web.1]: npm ERR! node v5.10.1
2016-04-21T22:20:50.555119+00:00 app[web.1]: npm ERR! npm v3.8.3
2016-04-21T22:20:50.555339+00:00 app[web.1]: npm ERR! file sh
2016-04-21T22:20:50.555549+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-04-21T22:20:50.555769+00:00 app[web.1]: npm ERR! errno ENOENT
2016-04-21T22:20:50.555965+00:00 app[web.1]: npm ERR! syscall spawn
2016-04-21T22:20:50.556142+00:00 app[web.1]: npm ERR! qc-server#1.0.0 start: `babel-node index.js`
2016-04-21T22:20:50.556305+00:00 app[web.1]: npm ERR! spawn ENOENT
2016-04-21T22:20:50.556488+00:00 app[web.1]: npm ERR!
2016-04-21T22:20:50.556666+00:00 app[web.1]: npm ERR! Failed at the qc-server#1.0.0 start script 'babel-node index.js'.
2016-04-21T22:20:50.556854+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-04-21T22:20:50.557017+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the qc-server package,
2016-04-21T22:20:50.557175+00:00 app[web.1]: npm ERR! not with npm itself.
2016-04-21T22:20:50.557343+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-04-21T22:20:50.557564+00:00 app[web.1]: npm ERR! babel-node index.js
2016-04-21T22:20:50.557741+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-04-21T22:20:50.557916+00:00 app[web.1]: npm ERR! npm bugs qc-server
2016-04-21T22:20:50.558110+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-04-21T22:20:50.558306+00:00 app[web.1]: npm ERR! npm owner ls qc-server
2016-04-21T22:20:50.558492+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-04-21T22:20:50.563859+00:00 app[web.1]:
2016-04-21T22:20:50.567790+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-04-21T22:20:50.568004+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-04-21T22:20:51.824822+00:00 heroku[web.1]: State changed from starting to crashed
2016-04-21T22:20:51.808246+00:00 heroku[web.1]: Process exited with status 1
My package.json:
{
"name": "qc-server",
"version": "1.0.0",
"description": "xxxx",
"main": "index.js",
"scripts": {
"test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js 'test/**/*.js'",
"test:watch": "npm run test -- --watch -G",
"start": "babel-node index.js"
},
"babel": {
"presets": [
"es2015"
]
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.6.0",
"babel-core": "^6.6.0",
"babel-eslint": "^5.0.0",
"babel-preset-es2015": "^6.6.0",
"chai": "^3.5.0",
"chai-immutable": "^1.5.3",
"eslint": "^2.2.0",
"eslint-config-airbnb": "^6.0.2",
"eslint-plugin-react": "^4.1.0",
"mocha": "^2.4.5"
},
"dependencies": {
"express": "^4.13.4",
"immutable": "^3.7.6",
"node-uuid": "^1.4.7",
"redux": "^3.3.1",
"socket.io": "^1.4.5"
}
}
Anyone have suggestions?
You have to include the dependency in you package.json so it will install it when you deploy.
$ npm install babel-cli -S
Than you have to change you start command to be like:
"start": "babel-node index.js"
See here for more info on deploying babel on heroku.com.
Warning: using babel-node is not recommended in production
I got the same issue, but I think set NPM_CONFIG_PRODUCTION=false to install devDependencies will be better. I used below command:
heroku config:set NPM_CONFIG_PRODUCTION=false
Specifically, include the necessary dependency under 'dependencies' and not 'devDependencies' in your 'package.json file'. This is because Heroku prunes (removes) your 'devDependencies' once it completes its build process, leaving only the 'dependencies', to keep the app as lean as possible.
This causes errors if you've built your NodeJS app using ES6 modules and included the necessary dependencies under 'devDependencies' instead of 'dependencies', namely the '#babel/' family of dependencies.
Update
You should always build your NodeJS App before you deploy it so that you are always running the production build in the live environment which executes much faster with fewer resources.

Resources