I am trying to deploy my create-react-app on heroku under my node/express server. I am using the heroku postbuild script but I am getting an error about react-script build. Well I am new to the backend side and not knowledged about heroku deployments.
//my npde server scripts
"scripts": {
"start": "node index.js",
"server": "nodemon index.js",
"client": "npm run 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"
},
//my client scripts
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
//The error log
remote: /tmp/build_9c0331519287501c707a58e785c7cac2/client/node_modules/react-scripts/config/webpack.config.js:306
remote: ...(isEnvProductionProfile && {
remote: ^^^
remote:
remote: SyntaxError: Unexpected token ...
remote: at createScript (vm.js:74:10)
remote: at Object.runInThisContext (vm.js:116:10)
remote: at Module._compile (module.js:533:28)
remote: at Object.Module._extensions..js (module.js:580:10)
remote: at Module.load (module.js:503:32)
remote: at tryModuleLoad (module.js:466:12)
remote: at Function.Module._load (module.js:458:3)
remote: at Module.require (module.js:513:17)
remote: at require (internal/module.js:11:18)
remote: at Object.<anonymous> (/tmp/build_9c0331519287501c707a58e785c7cac2/client/node_modules/react-scripts/scripts/build.js:38:23)
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! [email protected] build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the [email protected] build 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.eaz5f/_logs/2020-06-09T08_25_12_438Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! [email protected] heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the [email protected] 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.eaz5f/_logs/2020-06-09T08_25_12_454Z-debug.log