amazona icon indicating copy to clipboard operation
amazona copied to clipboard

heroku demand ES2015 or SyntaxError: Unexpected identifier for server side

Open 1xo2 opened this issue 4 years ago • 1 comments

i have fallow the tutorial up to video no 45 - full course. i getting this error when deploying to heroku.

/app/back-end/server.js:1 import express from 'express' ^^^^^^^ app[web.1]: app[web.1]: SyntaxError: Unexpected identifier.

at video 45 the website is pushing to heroku as is.. and in my case i had to convert only the server side to es2015 to see it working on heroku.

this is my root package.json

`{

"name": "amazona-shop-ml-1",

"version": "1.0.0", "description": "eCom react and node look like amazon", "main": "index.js", "engines": { "node": "12.4.0", "npm": "6.9.0" }, "scripts": { "build": "cd front-end && npm install && npm run build", "start": "nodemon --watch back-end --exec node --experimental-modules back-end/server.js"
}, "scriptsxxxxx": { "heroku-postbuild": "npm run build && cd front-end && npm install && npm run build", "build": "cd front-end && npm install && npm run build", "start": "nodemon --watch back-end --exec babel-node back-end/server.js", "server": "nodemon --watch back-end --exec babel-node back-end/server.js", "client": "cd front-end && npm run start", "dev": "npm run server & (npm run client)", "dev1": "concurrently "npm run server" "npm run client"" }, "author": "", "license": "ISC", "dependencies": { "bcrypt": "^5.0.0", "bcryptjs": "^2.4.3", "body-parser": "^1.19.0", "concurrently": "^5.3.0", "dotenv": "^8.2.0", "express": "^4.17.1", "express-async-handler": "^1.1.4", "jsonwebtoken": "^8.5.1", "mongoose": "^5.10.15", "multer": "^1.4.2" }, "devDependencies": { "@babel/cli": "^7.12.1", "@babel/core": "^7.12.3", "@babel/node": "^7.12.6", "@babel/preset-env": "^7.12.1", "eslint": "^7.15.0", "eslint-plugin-react": "^7.21.5", "nodemon": "^2.0.6" } } `

i would like to use the save ES version as in the course and not an old version of java script.

regards.

1xo2 avatar Jan 01 '21 10:01 1xo2

set" type":"module" in package.json

shivamm620 avatar Mar 10 '21 08:03 shivamm620