【发布时间】:2020-09-28 09:37:24
【问题描述】:
我正在尝试在我的 node/express 服务器下的 heroku 上部署我的 create-react-app。 我正在使用 heroku postbuild 脚本,但我收到有关 react-script build 的错误。 好吧,我是后端新手,不了解 heroku 部署。
//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! client@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the client@0.1.0 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! noode-server@1.0.0 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 noode-server@1.0.0 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
【问题讨论】:
标签: node.js reactjs heroku npm