Nodejs: Error starting web application in production environment - node.js

When I try to start my web application with Nodejs only, I've no any problem and my web application works fine.
But when I try to simulate in my laptop the start in production, namely, the static pages will be served by webpack server and the data from the API will be served by Nodejs. I've got this error:
/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/convert-source-map/index.js:61
return SafeBuffer.Buffer.from(json, 'utf8').toString('base64');
^
TypeError: Cannot read property 'from' of undefined
at Converter.toBase64 (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/convert-source-map/index.js:61:28)
at Converter.toComment (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/convert-source-map/index.js:65:21)
at generateCode (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/#babel/core/lib/transformation/file/generate.js:78:76)
at runSync (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/#babel/core/lib/transformation/index.js:50:51)
at transformSync (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/#babel/core/lib/transform.js:43:38)
at Object.transform (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/#babel/core/lib/transform.js:22:38)
at compile (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/#babel/register/lib/node.js:73:20)
at compileHook (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/#babel/register/lib/node.js:102:12)
at Module._compile (/home/josecarlos/Workspace/nodejs/basketmetrics3/node_modules/pirates/lib/index.js:93:29)
at Module._extensions..js (internal/modules/cjs/loader.js:827:10)
To start my project I use this command npm run start
These are my config files:
package.json
{
"name": "basketmetrics3",
"version": "1.0.0",
"description": "Basketball advanced stats",
"main": "server.js",
"scripts": {
"dev-webpack": "webpack-dev-server --hot --mode development",
"clean": "rm -rf ./dist",
"dev": "npm run clean && npm run compile-dev && cross-env NODE_ENV=development nodemon --exec babel-node src/server/server.js --ignore ./src/client",
"compile-dev": "NODE_ENV=development webpack -d --config ./webpack.config.babel.js --progress",
"compile": "NODE_ENV=production webpack -p --config ./webpack.config.babel.js --progress",
"start": "npm run clean && npm run compile && cross-env NODE_ENV=production babel-node src/server/server.js --ignore ./src/client"
},
"license": "ISC",
"dependencies": {
"#babel/polyfill": "^7.4.4",
"#material-ui/core": "^3.9.3",
"#material-ui/icons": "^3.0.2",
"bootstrap": "^4.3.1",
"cors": "^2.8.5",
"create-react-app": "^3.0.1",
"cross-env": "^5.2.0",
"d3": "^5.9.7",
"dotenv": "^7.0.0",
"express": "^4.17.1",
"express-graphql": "^0.7.1",
"graphql": "^14.4.2",
"jquery": "^3.4.1",
"morgan": "^1.9.1",
"mysql2": "^1.6.5",
"popper.js": "^1.15.0",
"react": "^16.8.6",
"react-bootstrap": "^1.0.0-beta.10",
"react-bootstrap-table-next": "^3.1.7",
"react-bootstrap-table2-paginator": "^2.0.7",
"react-dom": "^16.8.6",
"react-multi-language": "^0.4.2",
"react-router-dom": "^5.0.1",
"react-simple-tooltip": "^2.6.1",
"sequelize": "^4.44.2",
"validator": "^10.11.0"
},
"devDependencies": {
"#babel/cli": "^7.5.5",
"#babel/core": "^7.5.5",
"#babel/node": "^7.5.5",
"#babel/preset-env": "^7.5.5",
"#babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-register": "^6.26.0",
"css-loader": "^2.1.1",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.5.0",
"nodemon": "^1.19.1",
"path": "^0.12.7",
"style-loader": "^0.23.1",
"url-loader": "^1.1.2",
"webpack": "^4.38.0",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.7.2"
}
}
.babelrc
{
"presets": [
["#babel/preset-env" , {"modules": "cjs"}],
"#babel/preset-react"
],
"plugins": [
"transform-class-properties"
],
"ignore": [
"./node_modules"
]
}
I have been looking for information about my problem and I have found that I have to add "ignore: [node_modules]" to my .babelrc file. But, after I have added this entry in my .babelrc file, my application still doesn't work :(
Is there any other way to ignore "node_modules" with node.js? How can I ignore "node_modules"? If this is the real reason of my error, of course.
What can I do to fix the error that I've got?

I have found a solution to my problem. Changing the start script adding the ignore of "node_modules" is enough.
My "start" script in package.json will be:
"scripts": {
"dev-webpack": "webpack-dev-server --hot --mode development",
"clean": "rm -rf ./dist",
"dev": "npm run clean && npm run compile-dev && cross-env NODE_ENV=development nodemon --exec babel-node src/server/server.js --ignore ./src/client",
"compile-dev": "NODE_ENV=development webpack -d --config ./webpack.config.babel.js --progress",
"compile": "NODE_ENV=production webpack -p --config ./webpack.config.babel.js --progress",
"start": "npm run clean && npm run compile && cross-env NODE_ENV=production babel-node src/server/server.js --ignore ./node_modules"
},

Related

Yarn - error Couldn't find any versions for "#typescript-eslint/type-utils" that matches "5.31.0"

working on node app, with docker.
getting the error during image build, in the install step.
locally the installation works fine.
we use nexus, but again locally through nexus the installation works.
I tried adding resolutions for the packages in the error still, yarn throws the title error.
Package.json
{
"name": "my-graphql-service",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/my-graphql-service.git",
"author": "Itay Tur",
"license": "MIT",
"scripts": {
"dev:edge2": "NODE_ENV=development nodemon -r dotenv/config src/index.ts dotenv_config_path=config/edge2.env",
"dev:qa": "NODE_ENV=development nodemon -r dotenv/config src/index.ts dotenv_config_path=config/qa.env",
"generate:integrations": "node src/generate-integrations-code.js",
"build": "rimraf build && NODE_ENV=production tsc --project tsconfig.json",
"start": "NODE_ENV=production node -r dotenv/config build/index.js dotenv_config_path=.env.graph",
"test": "NODE_ENV=development jest --detectOpenHandles --forceExit",
"test:watch": "NODE_ENV=development jest --watch --detectOpenHandles --forceExit",
"format": "prettier --write .",
"lint": "eslint . --fix",
"prepare": "husky install"
},
"resolutions": {
"pretty-format": "^26.0.1",
"jest-diff": "^25.1.0",
"jest-matcher-utils": "^25.1.0",
"#typescript-eslint/type-utils": "#5.30.6",
"#typescript-eslint/utils": "5.30.6"
},
"dependencies": {
"#graphile-contrib/pg-order-by-related": "^1.0.0-beta.6",
"#graphile-contrib/pg-simplify-inflector": "^6.1.0",
"#graphile/pg-aggregates": "^0.1.0",
"#openapitools/openapi-generator-cli": "2.1.22",
"cors": "^2.8.5",
"cptls-common-nodejs": "^5.1.5",
"dataloader": "^2.1.0",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"postgraphile": "^4.12.9",
"postgraphile-plugin-connection-filter": "^2.3.0",
"rimraf": "^3.0.2",
"typescript": "^4.7.4"
},
"devDependencies": {
"#types/express": "^4.17.13",
"#types/jest": "^28.1.2",
"#types/supertest": "^2.0.12",
"#typescript-eslint/eslint-plugin": "^5.29.0",
"#typescript-eslint/parser": "^5.29.0",
"eslint": "^8.18.0",
"husky": "^8.0.0",
"jest": "^28.1.3",
"nodemon": "^2.0.16",
"prettier": "^2.7.1",
"supertest": "^6.2.3",
"ts-jest": "^28.0.5",
"ts-node": "^10.8.1"
}
}
Solution:
delete node_modules & yarn.lock
remove the resolutions
run yarn

How to create tree-shakable react module? package.json "exports" not working

I'm trying to build a react components library (e.g Buttons, Modals, etc.)
But until now I still cannot figure how to do nested imports
the objective that i want to have is to be able to do this
import Something from '#company/moduleName/Something'
here is my package.json
{
"name": "#company/moduleName",
"version": "1.0.0",
"description": "company's react design system",
"author": "",
"license": "",
"repository": "",
"main": "dist/index.js",
"module": "dist/index.modern.js",
"source": "src/index.js",
"engines": {
"node": ">=13",
"npm": ">=7"
},
"type": "module",
"exports": {
".": "./dist/index.modern.js",
"./Button": "./dist/Button.modern.js",
"./Container": "./dist/Container.modern.js",
"./Input": "./dist/Input.modern.js",
"./Modal": "./dist/Modal.modern.js",
"./Select": "./dist/Select.modern.js",
"./Separator": "./dist/Separator.modern.js",
"./Sidebar": "./dist/Sidebar.modern.js",
"./Tab": "./dist/Tab.modern.js",
"./TextArea": "./dist/TextArea.modern.js",
"./theme": "./dist/theme.modern.js",
"./Typography": "./dist/Typography.modern.js"
},
"scripts": {
"build": "microbundle src/*.js --no-compress --no-sourcemap -f modern,cjs",
"start": "microbundle src/*.js --no-compress --no-sourcemap -f modern,cjs watch",
"rename": "cd dist && ren *.modern.js *.js",
"prepare": "run-s build",
"test": "run-s test:unit test:lint test:build",
"test:build": "run-s build",
"test:lint": "eslint .",
"test:unit": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"predeploy": "cd example && npm install && npm run build",
"deploy": "gh-pages -d example/build"
},
"peerDependencies": {
"react": "^17.0.1",
"lodash.merge": "^4.6.2",
"react-icons": "^4.2.0",
"react-modal": "^3.12.1",
"react-select": "^4.1.0",
"styled-components": "^5.2.1"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"cross-env": "^7.0.2",
"env-cmd": "^10.1.0",
"eslint": "^7.21.0",
"eslint-config-prettier": "^6.7.0",
"eslint-config-standard": "^14.1.0",
"eslint-config-standard-react": "^9.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-standard": "^4.0.1",
"gh-pages": "^2.2.0",
"microbundle": "latest",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.4",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "^4.0.3",
"lodash.merge": "^4.6.2",
"react-icons": "^4.2.0",
"react-modal": "^3.12.1",
"react-select": "^4.1.0",
"styled-components": "^5.2.1"
},
"files": [
"dist"
],
}
currently i'm using microbundle to build everything in the src/ folder. I've added the exports field but it still says this in the example project inside the module
Module not found: Can't resolve '#company/moduleName/Button' in 'E:\Projects\Software\company\moduleName\example\src'
edit
To be clear, the dist folder shows up the correct desired result
-dist
index.modern.js
Modal.modern.js
...
I've also been able to do this, but this is not the desired output
#company/moduleName/dist/Something.modern
Any help would be greatly appreciated!

How to properly build the Docker with nodejs/ts?

Been struggling for a couple days to run the project in prod and it just keeps showing different errors. The last one(hopefully) is:
> rimraf dist && tsc -p tsconfig.build.json
tsc-watch/test/fixtures/failing.ts(2,1): error TS1005: '}' expected.
But tsconfig.build.json is fine:
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}
It happens after I try to build/run the docker container with:
docker-compose up --force-recreate --build
Here's what I have in the Dockerfile:
FROM node:11-stretch
ADD ./* $HOME/
RUN npm install
RUN npm run build
CMD npm run start:prod
And the package.json
{
"name": "mvp-api",
"private": true,
"version": "0.0.1",
"description": "MVP API",
"license": "MIT",
"scripts": {
"build": "rimraf dist && tsc -p tsconfig.build.json",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "tsc-watch -p tsconfig.build.json --onSuccess \"node dist/main.js\"",
"start:debug": "tsc-watch -p tsconfig.build.json --onSuccess \"node --inspect-brk dist/main.js\"",
"start:prod": "node dist/main.js",
"lint": "tslint -p tsconfig.json -c tslint.json",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"#nestjs/common": "^6.5.3",
"#nestjs/core": "^6.5.3",
"#nestjs/jwt": "^6.1.1",
"#nestjs/microservices": "^6.0.4",
"#nestjs/passport": "^6.1.0",
"#nestjs/platform-express": "^6.0.4",
"#nestjs/swagger": "^3.1.0",
"#nestjs/typeorm": "^6.1.3",
"#nestjs/websockets": "^6.0.4",
"#nestrx/twilio": "0.0.2",
"#types/mailgun-js": "^0.22.3",
"#types/qrcode": "^1.3.4",
"aws-sdk": "^2.513.0",
"cache-manager": "^2.10.0",
"cache-manager-mongodb": "^0.2.1",
"cache-manager-redis-store": "^1.5.0",
"class-transformer": "^0.2.3",
"class-validator": "^0.10.0",
"dotenv": "^8.0.0",
"hbs": "^4.0.4",
"is-base64": "^0.1.0",
"libphonenumber-js": "^1.7.22",
"mailgun-js": "^0.22.0",
"mysql": "^2.17.1",
"nestjs-config": "^1.4.3",
"onesignal-node": "^2.1.1",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"qrcode": "^1.4.1",
"randomstring": "^1.1.5",
"reflect-metadata": "0.1.13",
"rimraf": "2.6.3",
"rxjs": "6.4.0",
"swagger-ui-express": "^4.0.7",
"twilio": "^3.33.4",
"typeorm": "^0.2.18",
"vcard-generator": "0.0.7"
},
"devDependencies": {
"#nestjs/testing": "6.1.1",
"#types/cache-manager": "^2.10.0",
"#types/express": "4.16.1",
"#types/jest": "24.0.11",
"#types/node": "11.13.4",
"#types/randomstring": "^1.1.6",
"#types/supertest": "2.0.7",
"jest": "24.7.1",
"prettier": "1.17.0",
"supertest": "4.0.2",
"ts-jest": "24.0.2",
"ts-loader": "^6.0.4",
"ts-node": "8.1.0",
"tsc-watch": "2.2.1",
"tsconfig-paths": "3.8.0",
"tslint": "5.16.0",
"typescript": "3.4.3",
"webpack": "^4.39.2",
"webpack-cli": "^3.3.6",
"webpack-node-externals": "^1.7.2"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
It used to build fine with these configurations but after purging all containers/images and trying to recreate everything it just doesn't work.
Does anyone know how to get it to run properly in prod?
Apparently the problem was that the node_modules would keep copying over.
Adding a .dockerignore file with the following content solves the problem:
node_modules
Now I can run the docker container successfully.

How to deploy Node.js / React application to Heroku using Babel when writing ES6 code?

I have an application using React and Node.js. I'm struggling to deploy this to Heroku as I need to use Babel to transpile the code. Can someone help with setting the scripts I need to run?
I'm currently struggling to understand how to run client and server correctly as I'm getting an error regarding module location:
Error: Cannot find module '/app/build/index.js'
This is my package.json
{
"main": "server.js",
"scripts": {
"server": "nodemon server/server.js --ignore './client/' --exec babel-node -e js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"clean": "rm -rf build && mkdir build",
"build-babel": "babel -d ./build ./server/server.js -s",
"build": "npm run clean && npm run build-babel",
"start": "npm run build && node ./build/index.js",
"heroku-postbuild": "npm install --prefix client && npm run build --prefix client"
},
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"concurrently": "^4.1.0",
"express": "^4.16.4",
"google-play-scraper": "^6.2.8",
"googleapis": "^39.2.0",
"is-empty": "^1.2.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.4.19",
"mongoose-paginate-v2": "^1.0.24",
"multer": "^1.4.1",
"node-fetch": "^2.3.0",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"validator": "^10.11.0",
"winston": "^3.2.1",
"xml2js": "^0.4.19",
"#babel/core": "^7.3.4",
"#babel/node": "^7.2.2",
"babel-cli": "^6.26.0",
"babel-loader": "^8.0.5",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.17.2",
"nodemon": "^1.18.10"
}
}
And the file structure of the important files:
node_modules
.babelrc
babel.config.js
package-lock.json
package.json
client
--package-lock.json
--package.json
node_modules
--src
----index.js
server
--server.js
I assume I'm setting up the scripts incorrectly.
My problem was with some of the scripts. This is the final package.json that got it all working.
{
"main": "server.js",
"scripts": {
"server": "nodemon server/server.js --ignore './client/' --exec babel-node -e js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"start": "npm run build && node ./build/server.js",
"build": "npm run clean && npm run build-babel",
"clean": "rm -rf ./build && mkdir ./build",
"build-babel": "babel -d ./build ./server -s",
"heroku-postbuild": "npm install --prefix client && npm run build --prefix client"
},
"dependencies": {
"#babel/core": "^7.3.4",
"#babel/node": "^7.2.2",
"babel-cli": "^6.26.0",
"babel-loader": "^8.0.5",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"concurrently": "^4.1.0",
"express": "^4.16.4",
"google-play-scraper": "^7.0.2",
"googleapis": "^39.2.0",
"is-empty": "^1.2.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.4.19",
"mongoose-paginate-v2": "^1.0.24",
"multer": "^1.4.1",
"node-fetch": "^2.3.0",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"validator": "^10.11.0",
"winston": "^3.2.1",
"xml2js": "^0.4.19"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.17.2",
"nodemon": "^1.18.10"
}
}

Babel and Deploy Nodejs to Google App Engine

I'm a newbie nodejs. I have a trouble about deploying nodejs app to google app engine. This is my error, I have been trying to fix it but it's not work. I've installed babel.
Bug
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
restaurant_api#1.0.0 prestart /app
npm run -s build
You have mistakenly installed the babel package, which is a no-op in Babel 6.
Babel's CLI commands have been moved from the babel package to the babel-cli package.
npm uninstall babel
npm install --save-dev babel-cli
This is my package.json
"main": "dist",
"scripts": {
"dev": "NODE_ENV=development nodemon -w src --exec \"babel-node src --presets es2015,stage-0\"",
"build": "babel src -s -D -d dist --presets es2015,stage-0",
"start": "NODE_ENV=production pm2 start dist",
"prestart": "npm run -s build",
"lint": "eslint src",
"test": "echo \"Error: no test specified\" && exit 1",
"babel-version": "babel --version"
},
"eslintConfig": {
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
},
"env": {
"node": true
},
"rules": {
"no-console": 0,
"no-unused-vars": 1
}
},
"author": "",
"license": "ISC",
"dependencies": {
"babel": "^6.23.0",
"body-parser": "^1.17.0",
"express": "^4.15.0",
"express-jwt": "^5.1.0",
"jsonwebtoken": "^7.3.0",
"mongoose": "^4.8.5",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^4.0.0",
"pm2": "^2.4.2"
},
"devDependencies": {
"babel-cli": "^6.23.0",
"babel-eslint": "^7.1.1",
"babel-preset-es2015": "^6.22.0",
"babel-preset-stage-0": "^6.22.0",
"eslint": "^3.16.1"
}
Problem is quite simple, if you notice clearly GAE, does not install dev-dependencies. So move your dev-deps above inside deps , like I did and babel no found error is gone.
{
"name": "scraping",
"version": "0.3.0",
"description": "Starter project for an ES6 RESTful Express API",
"main": "dist",
"scripts": {
"dev": "nodemon -w src --exec \"babel-node src --presets es2015,stage-0\"",
"build": "babel src -s -D -d dist --presets es2015,stage-0",
"start": "node dist",
"prestart": "npm run -s build",
"test": "eslint src"
},
"eslintConfig": {
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
},
"env": {
"node": true
},
"rules": {
"no-console": 0,
"no-unused-vars": 1
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/developit/express-es6-rest-api.git"
},
"author": "Saransh Sharma <jason#developit.ca>",
"license": "MIT",
"dependencies": {
"body-parser": "^1.13.3",
"compression": "^1.5.2",
"cors": "^2.7.1",
"express": "^4.13.3",
"morgan": "^1.8.0",
"resource-router-middleware": "^0.6.0",
"#jonstuebe/scraper": "^0.1.4",
"babel-cli": "^6.9.0",
"babel-core": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"eslint": "^3.1.1",
"nodemon": "^1.9.2"
},
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-core": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"eslint": "^3.1.1",
"nodemon": "^1.9.2"
},
"bugs": {
"url": "https://github.com/developit/express-es6-rest-api/issues"
},
"homepage": "https://github.com/developit/express-es6-rest-api#readme",
"keywords": [
"scraper",
"product",
"from",
"amazon"
]
}
The clue is in the error message.
In your devDependencies section, you already have babel-cli included.
However, your dependencies section still has a reference to "babel": "^6.23.0".
Either remove this line, or replace it with babel-cli, leaving you with:
"dependencies": {
"babel-cli": "^6.23.0",
"body-parser": "^1.17.0",
"express": "^4.15.0",
"express-jwt": "^5.1.0",
"jsonwebtoken": "^7.3.0",
"mongoose": "^4.8.5",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^4.0.0",
"pm2": "^2.4.2"
},
You need to install babel-cli globally, i.e. run the command "npm install babel-cli -g" as part of your build npm script, or create a pre-install script that install it if you want to keep it more organized in case you need to add more things later on.
"scripts": {
"dev": "NODE_ENV=development nodemon -w src --exec \"babel-node src --presets es2015,stage-0\"",
"build": "npm install bable-cli -g && babel src -s -D -d dist --presets es2015,stage-0",

Resources