我正在将用毛线工作区构建的React应用程序部署到heroku中。它在heroku部署上的节点构建期间使用react-app-rewired并失败。我需要在heroku上添加什么配置才能在monorepo上工作?任何建议的解决方案?在我的本地计算机上工作正常。
根文件夹package.json
。
{
"name": "isomorphic",
"description": "",
"version": "3.0.0",
"private": true,
"author": "RedQ Team",
"engines": {
"node": "10.16.2",
"yarn": "1.17.3",
"npm": "6.9.0"
},
"workspaces": [
"shared",
"packages/*"
],
"scripts": {
"clean": "lerna clean --yes && rimraf node_modules",
"clean:build": "lerna exec -- rimraf \"{.next,dist,out,build,.docz}\"",
"start:all": "lerna run --parallel start",
"start": "yarn workspace isomorphic run start",
"build": "yarn workspace isomorphic run build"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,md,css}": [
"prettier --trailing-comma es5 --single-quote --write",
"git add"
]
},
"devDependencies": {
"husky": "^3.0.2",
"lerna": "^3.16.4",
"lint-staged": "^9.2.1",
"prettier": "^1.18.2",
"rimraf": "^2.6.3"
}
}
工作区package.json
{
"name": "isomorphic",
"version": "2.9.6",
"private": true,
"dependencies": {
"@progress/kendo-drawing": "^1.5.12",
"@progress/kendo-react-pdf": "^2.11.0",
"@redq/js-info-bubble": "^0.8.1",
"antd": "^3.19.1",
"antd-local-icon": "^0.1.3",
"auth0-lock": "^11.16.0",
"card-react": "^1.2.7",
"chart.js": "^2.8.0",
"classnames": "^2.2.6",
"clone": "^2.1.2",
"connected-react-router": "^6.4.0",
"d3-shape": "^1.3.5",
"enzyme-adapter-react-16": "^1.13.1",
"enzyme-react-intl": "^2.0.4",
"express": "^4.17.1",
"firebase": "^6.1.0",
"formik": "^1.5.8",
"frappe-charts": "^0.0.8",
"fuse.js": "^3.4.4",
"globalize": "^1.4.2",
"history": "^4.9.0",
"js-rich-marker": "^1.1.2",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"node-sass": "^4.12.0",
"nprogress": "^0.2.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-addons-shallow-compare": "^15.6.2",
"react-app-rewired": "^2.1.3",
"react-beautiful-dnd": "^11.0.3",
"react-big-calendar": "^0.21.0",
"react-chartjs-2": "^2.7.6",
"react-codemirror": "^1.0.0",
"react-count-down": "^1.2.0",
"react-credit-cards": "^0.7.0",
"react-custom-scrollbars": "^4.2.1",
"react-dates": "^20.2.0",
"react-dnd": "^7.4.5",
"react-dnd-html5-backend": "^7.4.4",
"react-dom": "^16.8.6",
"react-drawer": "^1.3.4",
"react-dropzone-component": "^3.2.0",
"react-element-resize": "^0.2.2",
"react-error-overlay": "^5.1.6",
"react-flexbox-grid": "^2.1.2",
"react-flip-move": "^3.0.3",
"react-google-charts": "^3.0.13",
"react-grid-layout": "^0.16.6",
"react-instantsearch": "^4.3.0",
"react-intl": "^2.9.0",
"react-loadable": "^5.5.0",
"react-motion-drawer": "^3.1.0",
"react-perfect-scrollbar": "^1.5.2",
"react-placeholder": "^3.0.2",
"react-quill": "^1.3.3",
"react-redux": "^6.0.0",
"react-router": "^5.0.0",
"react-router-dom": "^5.0.0",
"react-router-redux": "^4.0.8",
"react-scripts": "^3.0.1",
"react-sidebar": "^3.0.2",
"react-speech-recognition": "^2.0.1",
"react-tag-input": "^6.4.0",
"react-test-renderer": "^16.8.6",
"react-throttle": "^0.3.0",
"react-trend": "^1.2.5",
"react-vis": "^1.11.7",
"react-window-size-listener": "^1.4.0",
"react-youtube": "^7.9.0",
"recharts": "^1.6.2",
"redux": "^4.0.1",
"redux-devtools": "^3.5.0",
"redux-devtools-dock-monitor": "^1.1.3",
"redux-devtools-log-monitor": "^1.4.0",
"redux-saga": "^1.0.2",
"redux-saga-firebase": "0.15.0",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"rheostat": "^3.0.2",
"rich-marker": "^0.0.1",
"styled-components": "^4.2.0",
"styled-theme": "^0.3.3",
"uppy": "0.18.0"
},
"devDependencies": {
"babel-plugin-import": "^1.12.0",
"customize-cra": "^0.2.12",
"enzyme": "^3.9.0",
"enzyme-to-json": "^3.3.5",
"google-maps-react": "^2.0.2",
"leaflet": "^1.5.1",
"leaflet-routing-machine": "^3.2.12",
"leaflet.markercluster": "^1.0.6",
"redux-mock-store": "^1.5.3"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
下面是来自heroku的错误日志
-----> Installing dependencies
Installing node modules (package.json)
audited 43847 packages in 10.675s
found 0 vulnerabilities
-----> Build
Running build
> isomorphic@3.0.0 build /tmp/build_fb4cef49ed7e273b88d0da197451d1c9
> yarn workspace isomorphic run build
yarn workspace v1.17.3
yarn run v1.17.3
$ react-app-rewired build
/bin/sh: 1: react-app-rewired: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 127
Command: /tmp/build_fb4cef49ed7e273b88d0da197451d1c9/.heroku/node/bin/node
Arguments: /tmp/build_fb4cef49ed7e273b88d0da197451d1c9/.heroku/yarn/lib/cli.js run build
Directory: /tmp/build_fb4cef49ed7e273b88d0da197451d1c9/packages/isomorphic
Output:
info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! isomorphic@3.0.0 build: `yarn workspace isomorphic run build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the isomorphic@3.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.hVThm/_logs/2019-09-04T01_44_16_303Z-debug.log