Cannot find module '/src/bin/www' - Docker and Mean Stack - node.js

I'm having issues creating my first docker container. I keep getting an error saying Cannot find module '/src/bin/www' when I enter docker-compose up In the package.json file I tried "start": "node /bin/www" and "start": "node ./bin/www" but same issue. Also the first time I ran it, it took about a minute, but ever since that when I run it, it throws the error within seconds. Don't know if that's relevant.
> backend#1.0.0 start /src
node_1 | > node ./bin/www
node_1 |
node_1 | internal/modules/cjs/loader.js:983
node_1 | throw err;
node_1 | ^
node_1 |
node_1 | Error: Cannot find module '/src/bin/www'
node_1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
node_1 | at Function.Module._load (internal/modules/cjs/loader.js:862:27)
node_1 | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
node_1 | at internal/main/run_main_module.js:17:47 {
node_1 | code: 'MODULE_NOT_FOUND',
node_1 | requireStack: []
node_1 | }
node_1 | npm ERR! code ELIFECYCLE
node_1 | npm ERR! errno 1
node_1 | npm ERR! backend#1.0.0 start: `node ./bin/www`
node_1 | npm ERR! Exit status 1
node_1 | npm ERR!
node_1 | npm ERR! Failed at the backend#1.0.0 start script.
node_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
node_1 |
node_1 | npm ERR! A complete log of this run can be found in:
node_1 | npm ERR! /root/.npm/_logs/2020-02-06T16_09_20_442Z-debug.log
myapp-docker_node_1 exited with code 1
Gracefully stopping... (press Ctrl+C again to force)
package.json
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node /bin/www"
},
"author": "",
"license": "ISC",
"dependencies": {
"aws-sdk": "^2.612.0",
"bcrypt": "^3.0.8",
"body-parser": "^1.19.0",
"create-hash": "^1.2.0",
"crypto": "^1.0.1",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.8.11",
"mongoose-unique-validator": "^2.0.3",
"multer": "^1.4.2",
"multer-s3": "^2.9.0"
}
}
docker-compose.yml
version: '3'
services:
web:
build: ./frontend
ports:
- "80:80"
links:
- node
volumes:
- "/Users/Phil/Documents/mysite/mysite-docker/frontend/dist:/usr/share/nginx/html"
node:
build: ./backend
ports:
- "3000:3000"
frontend docker file
FROM nginx
MAINTAINER Phil
VOLUME /Users/Phil/Documents/mysite/mysite-docker/frontend/dist:usr/share/nginx/html
EXPOSE 80
backend docker file
FROM node
MAINTAINER Phil
WORKDIR /src
COPY . /src
RUN npm install
RUN npm install -g nodemon
EXPOSE 3000
CMD ["npm", "start"]

Related

Why 'npm start' does not run the project in a browser with Node server.js at port :::3131 ? (JavaScript project)

I have a project written in JS around month ago. Since that time I didn't touch it.Now I wanna run the project again.
But when I type in Gitbash 'npm start' it's not opening the project in a browser.
It stucks at: 'node server.js' and doesn't go further.
Yesterday I had a problem with port 3131 where the project was deployed. I got information, the port was busy. So I used the 'netstat' command in CMD (windows) to find all open ports and then used 'taskkill' to terminate listening to port 3131.
But even after killing listening to that port, effect of 'npm start' was the same as today.
And it is happening with all my previous projects now. All of them where written during my online coding course in online coding School. I have finished it around a month ago.
Can it influence somehow at the issue with port 3131? Maybe I should change the port?
Important info: the project was deployed to Heroku, but couldn't work there. But even after deploying to Heroku 'npm start' was able to run project in the browser (a month ago).
BTW, 'npm run' looks like working fine, it runs all test etc.
Here is my package.json:
{
"name": "fer-07-project",
"version": "1.0.0",
"description": "",
"main": "index.html",
"scripts": {
"lint": "eslint --fix --ext .js,.jsx .",
"init-project": "npm install && npm-run-all init:*",
"init:dirs": "mkdirp dist src/sass src/css src/vendor src/images src/js",
"init:files": "touch README.md src/index.html src/sass/style.scss src/js/script.js",
"init:gitignore": "curl https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore -o .gitignore",
"init:gitignore:custom": "echo \"dist\" >> .gitignore",
"test": "npm-run-all test:*",
"test:html": "globstar nu-html-checker dist/*.html",
"test:js": "eslint src/js/ --fix",
"test:scss": "stylelint src/sass/",
"build": "npm-run-all build:* test",
"build:clean": "mkdirp dist && rm -r dist && mkdirp dist",
"build:copy": "copyfiles -a -u 1 -e \"**/sass/**/*\" -e \"**/.gitkeep\" \"src/**/*\" dist",
"build:sass": "node-sass --output-style compact -o dist/css src/sass",
"build:autoprefixer": "globstar autoprefixer-cli \"dist/css/*.css\"",
"build-dev": "npm-run-all build-dev:sass build:autoprefixer",
"build-dev:sass": "node-sass --output-style expanded --source-map true -o dist/css src/sass",
"server": "json-server --port 3131 --no-cors --delay 250 --watch dist/db/app.json",
"watch": "npm-run-all build build-dev -p watch:* server",
"watch:browsersync": "browser-sync start --server dist --files \"dist/**/*\" --ignore \"dist/db/**/*\"",
"watch:sassprefixer": "onchange \"src/sass/**/*.scss\" -- npm run build-dev",
"watch:copy": "onchange -e \"**/sass/**/*\" -e \"**/.gitkeep\" \"src/**/*\" -- copyfiles -a -u 1 {{changed}} dist"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"flatpickr": "^4.6.9",
"json-server": "^0.16.3",
"rangeslider-pure": "^0.4.11"
},
"devDependencies": {
"autoprefixer-cli": "^1.0.0",
"browser-sync": "^2.26.3",
"copyfiles": "^2.1.0",
"eslint": "^5.14.1",
"globstar": "^1.0.0",
"mkdirp": "^0.5.1",
"node-sass": "^4.11.0",
"npm-run-all": "^4.1.5",
"nu-html-checker": "^0.1.0",
"onchange": "^5.2.0",
"stylelint": "^9.10.1",
"stylelint-scss": "^3.5.4"
}
}
AND server.js:
/* global require, process */
const jsonServer = require('json-server');
const server = jsonServer.create();
const router = jsonServer.router('dist/db/app.json');
const middlewares = jsonServer.defaults({
static: 'dist',
noCors: true
});
const port = process.env.PORT || 3131;
server.use(middlewares);
server.use(router);
server.listen(port);
HERE IS AN ISSUE IN GITBASH WHEN STARTING ANOTHER PROJECT WITH 'YARN START'
$ yarn start
yarn run v1.22.10
$ npm-run-all -p server:*
$ node server.js
$ webpack-dev-server --mode development --open --hot
events.js:292
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3131
at Server.setupListenHandle [as _listen2] (net.js:1318:16)
at listenInCluster (net.js:1366:12)
at Server.listen (net.js:1452:7)
at Function.listen (C:\Users\kpych.LENOVO-KP\OneDrive\Pulpit\Nowy folder (4)\Project-12_Travel_agency\node_modules\express\lib\application.js:618:24)
at Object.<anonymous> (C:\Users\kpych.LENOVO-KP\OneDrive\Pulpit\Nowy folder (4)\Project-12_Travel_agency\server.js:32:10)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1345:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 3131
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "server:api" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Gitbash npm start

How to fix PM2 nodejs spawn babel-node ENOENT

I'm trying to run my nodejs project with PM2. Here's a part of my package.json
{
"scripts": {
"pretest": "yarn run test-cleanup",
"preinstall": "yarn global add pm2",
"build": "rm -rf dist && babel src --out-dir dist --source-maps --watch && cp -R src/utils/email/templates dist/utils/email/templates",
"build:tests": "babel tests --out-dir dist-tests",
"start": "pm2-runtime start ecosystem.prod.config.js",
"dev": "pm2 start ecosystem.dev.config.js && pm2 log",
"test": "concurrently 'yarn run test-not-ratelimit' 'yarn run test-ratelimit'",
"test:watch": "yarn run test-cleanup && yarn run test-not-ratelimit --watch --verbose",
"test-not-ratelimit": "ava --match='!*RateLimiter*' --fail-fast",
"test-ratelimit": "TESTING_RATELIMITER=true ava --match='*RateLimiter*' --fail-fast",
"test-cleanup": "node tests/_pretest-cleanup.js",
"prettier": "prettier --config ./.prettierrc --write \"**/*.js\"",
"lint": "prettier --check --config ./.prettierrc \"**/*.js\" && eslint ./src ./tests --max-warnings 0",
"lint-fix": "yarn prettier && eslint --fix ./src ./tests"
},
"heroku-run-build-script": true,
"devDependencies": {
"#babel/cli": "^7.7.4",
"#babel/core": "^7.7.4",
"#babel/node": "^7.7.4",
"#babel/preset-env": "^7.7.4",
"#babel/register": "^7.7.4",
"ava": "^2.4.0",
"babel-plugin-module-resolver": "^3.2.0",
"concurrently": "^5.0.0",
"eslint": "^6.7.1",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.7.0",
"eslint-import-resolver-babel-module": "^5.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^3.1.1",
"husky": "^3.1.0",
"lint-staged": "^9.5.0",
"prettier": "^1.19.1",
"rewiremock": "^3.13.9",
"sinon": "^7.5.0",
"supertest": "4.0.2"
},
"engines": {
"node": "12"
}
}
I run npm run dev and it show this error:
PM2 | at onErrorNT (internal/child_process.js:456:16)
PM2 | at processTicksAndRejections (internal/process/task_queues.js:80:21)
PM2 | 2019-12-03T10:08:05: PM2 log: App [api:0] starting in -fork mode-
PM2 | 2019-12-03T10:08:05: PM2 log: App [api:0] online
PM2 | 2019-12-03T10:08:05: PM2 error: Error: spawn babel-node ENOENT
PM2 | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
PM2 | at onErrorNT (internal/child_process.js:456:16)
PM2 | at processTicksAndRejections (internal/process/task_queues.js:80:21)
PM2 | 2019-12-03T10:08:05: PM2 log: App [conductor:1] starting in -fork mode-
PM2 | 2019-12-03T10:08:05: PM2 log: App [conductor:1] online
PM2 | 2019-12-03T10:08:05: PM2 error: Error: spawn babel-node ENOENT
PM2 | at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
PM2 | at onErrorNT (internal/child_process.js:456:16)
PM2 | at processTicksAndRejections (internal/process/task_queues.js:80:21)
I tried install babel-cli and babel-node globally but still got same error. Any suggestion?
P/s: this project already run in my friend's Macbook, and I'm using Windows. May Os difference is a reason?

Docker + NodeJS: Cannot Find package.json in directory

I am building out a ReactJS/Node.JS application in Docker. I am getting the following error where my package.json is never found:
server_1 |
server_1 | > stocklookback#1.0.0 dev /code/app/server
server_1 | > concurrently "npm run server" "npm run client"
server_1 |
server_1 | [1]
server_1 | [1] > stocklookback#1.0.0 client /code/app/server
server_1 | [1] > npm start
server_1 | [1]
server_1 | [0]
server_1 | [0] > stocklookback#1.0.0 server /code/app/server
server_1 | [0] > nodemon index.js
server_1 | [0]
client_1 | npm ERR! path /code/app/client/package.json
client_1 | npm ERR! code ENOENT
client_1 | npm ERR! errno -2
client_1 | npm ERR! syscall open
client_1 | npm ERR! enoent ENOENT: no such file or directory, open '/code/app/client/package.json'
client_1 | npm ERR! enoent This is related to npm not being able to find a file.
client_1 | npm ERR! enoent
client_1 |
client_1 | npm ERR! A complete log of this run can be found in:
client_1 | npm ERR! /root/.npm/_logs/2019-08-06T13_49_58_383Z-debug.log
server_1 | [1]
server_1 | [1] > stocklookback#1.0.0 start /code/app/server
server_1 | [1] > node index.js
server_1 | [1]
server_1 | [0] [nodemon] 1.19.1
server_1 | [0] [nodemon] to restart at any time, enter `rs`
server_1 | [0] [nodemon] watching: *.*
server_1 | [0] [nodemon] starting `node index.js`
stocklookback_client_1 exited with code 254
My Dockerfile for the client is:
FROM node:12.2.0-alpine
RUN mkdir -p /code/app/client
WORKDIR /code/app/client/
COPY package.json /code/app/client/
COPY package-lock.json /code/app/client/
RUN npm install
COPY . /code/app/client/
CMD [ "npm", "start" ]
The package.json is:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1"
},
"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"
]
}
}
And the docker-compose.yml is
version: '3.3'
volumes:
postgres_database :
external: false
services:
##########################
# Setup node container
##########################
server:
build: ./server
expose:
- ${APP_SERVER_PORT}
environment:
API_HOST: ${API_HOST}
APP_SERVER_PORT: ${APP_SERVER_PORT}
ports:
- ${APP_SERVER_PORT}:${APP_SERVER_PORT}
volumes:
- ./server:/code/app/server/src
command: npm run dev
##########################
# Setup client container
##########################
client:
build: ./client
environment:
- REACT_APP_PORT=${REACT_APP_PORT}
expose:
- ${REACT_APP_PORT}
ports:
- ${REACT_APP_PORT}:${REACT_APP_PORT}
volumes:
- ./client/src:/code/app/client/
- ./client/public:/code/app/client/public
links:
- server
command: npm start
The file structure is like so:
Why is my package.json not being copied over?

How to solve Node.js Error: Cannot find Module?

When I start a dockerized Node.js testapp with
sudo docker-compose up
I get the following error:
Starting testapp_web_1 ... done
Attaching to testapp_web_1
web_1 |
web_1 | > testapp#0.0.1 start /usr/app
web_1 | > node index.js
web_1 |
web_1 | internal/modules/cjs/loader.js:613
web_1 | throw err;
web_1 | ^
web_1 |
web_1 | Error: Cannot find module 'mongodb'
web_1 | Require stack:
web_1 | - /usr/app/index.js
web_1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
web_1 | at Function.Module._load (internal/modules/cjs/loader.js:526:27)
web_1 | at Module.require (internal/modules/cjs/loader.js:666:19)
web_1 | at require (internal/modules/cjs/helpers.js:16:16)
web_1 | at Object.<anonymous> (/usr/app/index.js:4:21)
web_1 | at Module._compile (internal/modules/cjs/loader.js:759:30)
web_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
web_1 | at Module.load (internal/modules/cjs/loader.js:628:32)
web_1 | at Function.Module._load (internal/modules/cjs/loader.js:555:12)
web_1 | at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
web_1 | npm ERR! code ELIFECYCLE
web_1 | npm ERR! errno 1
web_1 | npm ERR! testapp#0.0.1 start: `node index.js`
web_1 | npm ERR! Exit status 1
web_1 | npm ERR!
web_1 | npm ERR! Failed at the testapp#0.0.1 start script.
web_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
web_1 |
web_1 | npm ERR! A complete log of this run can be found in:
web_1 | npm ERR! /root/.npm/_logs/2019-05-04T15_34_04_615Z-debug.log
testapp_web_1 exited with code 1
The project structur is as follows
- testapp
--- docker-compose.yml
--- dockerfile
--- src
----- index.js
----- package.json
index.js
'use strict';
const MongoClient = require('mongodb').MongoClient;
const express = require('express');
// Constants
const PORT = 8080;
// App
const app = express();
app.get('/', (req, res) => {
res.send('Hello world\n');
});
app.listen(PORT);
console.log(`Running on Port:${PORT}`);
package.json
{
"name": "testapp",
"version": "0.0.1",
"description": "Testapp",
"author": "hi there",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "^4.16.4",
"mongodb": "^3.2.3"
}
}
dockerfile
FROM node:12-alpine
WORKDIR /usr/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
docker-compose.yml
version: '3'
services:
web:
build: .
command: npm start
volumes:
- ./src:/usr/app/
- /usr/app/node_modules
ports:
- 80:8080
I have alread read this stackoverflow thread but I couldn't solve this issue. I'm getting this error no matter what module I'm trying to use: mongodb, spdy, etc. Locally without docker the testapp is working. But I don't know what I'm doing wrong with docker. Can anyone help me?
Have volume folder mapping for node_modules and ensure it has mongo folder copied / created
version: '3'
services:
web:
build: .
command: npm start
volumes:
- ./src:/usr/app/
- ./src/node_modules:/usr/app/node_modules
ports:
- 80:8080
Ref:https://morioh.com/p/42531a398049/containerizing-a-node-js-application-for-development-with-docker-compose
You need to drop & rebuild the anonymous volume holding the node_modules for the updates to package.json to take effect.
docker-compose rm -v
# then:
docker-compose build
docker-compose up
You will only have to do this for changes to node_modules, since the other volume is linked to your ./src/, and will reflect changes on the host.

Deployment to heroku [Error: spawn babel-node ENOENT]

Project works perfectly on dev machine. I've already spent more than 5 hours:
trying out different configurations using bash 'start' scripts on heroku remotely
installing babel-cli and babel-preset-env as dependencies instead of devDependencies
reading through heroku documentation about local builds, trying out
them
disabling dotenv in production
What are your suggestions / solution to this babel-node and heroku incompatibility? Maybe they're disabling it, since it makes more load on their server memory? I've written all my files in ES6 and I tried to rewrite them to old syntax, but that's almost impossible. Is there a way to make babel work on server-side for heroku?
Heroku application log:
2018-05-01T12:08:44.677261+00:00 heroku[web.1]: Starting process with command `npm start`
2018-05-01T12:08:47.873964+00:00 app[web.1]: [heroku-exec] Starting
2018-05-01T12:08:48.920661+00:00 app[web.1]:
2018-05-01T12:08:48.920707+00:00 app[web.1]: > rearn#1.0.0 start /app
2018-05-01T12:08:48.920710+00:00 app[web.1]: > cross-env NODE_ENV=production babel-node server/server.js
2018-05-01T12:08:48.920712+00:00 app[web.1]:
2018-05-01T12:08:49.196690+00:00 app[web.1]: events.js:183
2018-05-01T12:08:49.196703+00:00 app[web.1]: throw er; // Unhandled 'error' event
2018-05-01T12:08:49.196704+00:00 app[web.1]: ^
2018-05-01T12:08:49.196706+00:00 app[web.1]:
2018-05-01T12:08:49.196709+00:00 app[web.1]: Error: spawn babel-node ENOENT
2018-05-01T12:08:49.196710+00:00 app[web.1]: at _errnoException (util.js:1024:11)
2018-05-01T12:08:49.196712+00:00 app[web.1]: at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
2018-05-01T12:08:49.196714+00:00 app[web.1]: at onErrorNT (internal/child_process.js:372:16)
2018-05-01T12:08:49.196717+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:138:11)
2018-05-01T12:08:49.196718+00:00 app[web.1]: at process._tickCallback (internal/process/next_tick.js:180:9)
2018-05-01T12:08:49.196720+00:00 app[web.1]: at Function.Module.runMain (module.js:678:11)
2018-05-01T12:08:49.196721+00:00 app[web.1]: at startup (bootstrap_node.js:187:16)
2018-05-01T12:08:49.196723+00:00 app[web.1]: at bootstrap_node.js:608:3
2018-05-01T12:08:49.206967+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-05-01T12:08:49.208660+00:00 app[web.1]: npm ERR! errno 1
2018-05-01T12:08:49.211774+00:00 app[web.1]: npm ERR! rearn#1.0.0 start: `cross-env NODE_ENV=production babel-node server/server.js`
2018-05-01T12:08:49.212391+00:00 app[web.1]: npm ERR! Exit status 1
2018-05-01T12:08:49.212731+00:00 app[web.1]: npm ERR!
2018-05-01T12:08:49.212944+00:00 app[web.1]: npm ERR! Failed at the rearn#1.0.0 start script.
2018-05-01T12:08:49.213151+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-05-01T12:08:49.220087+00:00 app[web.1]:
2018-05-01T12:08:49.220400+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-05-01T12:08:49.220579+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-05-01T12_08_49_214Z-debug.log
2018-05-01T12:08:49.315806+00:00 heroku[web.1]: State changed from starting to crashed
2018-05-01T12:08:49.301459+00:00 heroku[web.1]: Process exited with status 1
package.json:
{
"name": "rearn",
"version": "1.0.0",
"description": "",
"main": "index.js",
"engines": {
"node": "8.9.3",
"npm": "5.6.0"
},
"scripts": {
"build": "next build",
"start": "cross-env NODE_ENV=production babel-node server/server.js",
"test": "eslint pages components lib",
"dev": "nodemon server/server.js --watch server --exec babel-node server/server.js",
"port": "cross-env PORT=4000 npm start",
"prod": "yarn build && cross-env NODE_ENV=production babel-node server/server.js",
"precommit": "yarn test",
"prepush": "yarn test",
"heroku-postbuild": "YARN_PRODUCTION=false yarn install && yarn build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#zeit/next-sass": "^0.1.2",
"axios": "^0.18.0",
"bootstrap": "4.0.0",
"bootstrap-material-design": "^4.1.1",
"connect-mongo": "^2.0.1",
"cross-env": "^5.1.4",
"dotenv": "^5.0.1",
"express": "^4.16.3",
"express-session": "^1.15.6",
"express-useragent": "^1.0.12",
"jquery": "^3.3.1",
"material-ui": "^0.20.0",
"mongoose": "^5.0.15",
"next": "5.1.0",
"next-offline": "^2.5.0",
"next-redux-wrapper": "^1.3.5",
"node-sass": "^4.8.3",
"passport": "^0.4.0",
"passport-google-oauth": "^1.0.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-popper": "^0.10.1",
"react-redux": "^5.0.7",
"react-reveal": "^1.2.1",
"react-transition-group": "^2.3.0",
"redux": "^4.0.0",
"redux-form": "^7.3.0",
"redux-thunk": "^2.2.0",
"styled-jsx": "^2.2.6",
"workbox-background-sync": "^3.0.1"
},
"browserslist": [
"> 1%"
],
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"eslint": "4.9.0",
"eslint-config-airbnb": "16.1.0",
"eslint-plugin-compat": "^2.2.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "6.0.2",
"eslint-plugin-react": "7.4.0",
"husky": "^0.14.3"
}
}
Solved. Actually I was removing and installing babel-cli and babel-preset-env in bash and somehow heroku didn't update package.json remotely? Why? Solution:
installing babel-cli and babel-preset-env as dependencies instead of
devDependencies (actually babel-cli only is enough for next.js, as it uses latest babel config).
Found this post, since i had a similar problem.
moved the whole block of
"#babel/cli": "7.5.5",
"#babel/core": "7.5.5",
"#babel/node": "7.5.5",
"#babel/plugin-transform-runtime": "7.5.5",
"#babel/preset-env": "7.5.5",
"#babel/runtime": "7.5.5",
from devDepenencies to the dependencies section of package.json = problem solved for now, maybe not the final perfect solution, tough

Resources