ローカルの環境では問題がありませんが、このスクリプトを使用してJenkinsで生産環境を実行しています。
yarn install --production
yarn build
ビルドは5分のように取りますが、最後に、Jenkinsはこのコンソール出力エラーで終了します。
+ yarn install --production
yarn install v1.9.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "[email protected] - 3".
warning " > [email protected]" has unmet peer dependency "popper.js@^1.14.7".
warning " > [email protected]" has incorrect peer dependency "react@~0.14.8 || ^15.0.0".
warning " > [email protected]" has incorrect peer dependency "react-dom@~0.14.8 || ^15.0.0".
warning " > [email protected]" has incorrect peer dependency "react@^15.4.2".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.0.0".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.0.0".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.0.0".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.5.4".
warning " > [email protected]" has incorrect peer dependency "react@^0.14.3".
warning " > [email protected]" has incorrect peer dependency "react-dom@^0.14.3".
warning " > [email protected]" has incorrect peer dependency "react-widgets@^4.2.2".
warning " > [email protected]" has incorrect peer dependency "react-widgets@^4.2.2".
warning " > [email protected]" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0".
warning "react-styleguidist > [email protected]" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning "react-styleguidist > [email protected]" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0".
[4/4] Building fresh packages...
Done in 28.04s.
+ yarn build
yarn run v1.9.4
$ react-scripts build
Creating an optimized production build...
<--- Last few GCs --->
[31498:0x2ab86d0] 229792 ms: Mark-sweep 1277.3 (1459.7) -> 1277.2 (1461.7) MB, 1801.1 / 0.0 ms allocation failure GC in old space requested
[31498:0x2ab86d0] 231676 ms: Mark-sweep 1277.2 (1461.7) -> 1277.0 (1420.7) MB, 1884.4 / 0.0 ms last resort GC in old space requested
[31498:0x2ab86d0] 233210 ms: Mark-sweep 1277.0 (1420.7) -> 1277.0 (1419.2) MB, 1533.2 / 0.0 ms last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0xb1707c25879 <JSObject>
0: builtin exit frame: stringify(this=0xb1707c090a9 <Object map = 0x123a95202ba1>,0x11b5562822d1 <undefined>,0x11b5562822d1 <undefined>,0x26b024683529 <Object map = 0x2449e8a328d1>)
1: arguments adaptor frame: 1->3
2: toString [0x11b5562822d1 <undefined>:9522] [bytecode=0xf76e19f6a69 offset=28](this=0xb3c89b82b29 <Object map = 0x306621cb3d19>)
7: /* anonymous */(aka /* anonymous ...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0x8c21ec [node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
5: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [node]
6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [node]
7: v8::internal::JsonStringifier::SerializeString(v8::internal::Handle<v8::internal::String>) [node]
8: v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<true>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [node]
9: v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [node]
10: v8::internal::JsonStringifier::Stringify(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [node]
11: v8::internal::Builtin_JsonStringify(int, v8::internal::Object**, v8::internal::Isolate*) [node]
12: 0x14795198697d
error Command failed with exit code 1.
このエラーの生成から開始された唯一の変更は、2ノードの依存関係の適合でした。
"react-accessible-accordion": "^3.0.0",
"react-simple-collapse": "^0.1.2",
Full package.jsonはこれです:
{
"name": "front-master",
"version": "0.1.0",
"private": true,
"dependencies": {
"@blueprintjs/core": "^2.3.1",
"@blueprintjs/select": "^2.0.1",
"@esri/arcgis-to-geojson-utils": "^1.3.0",
"@kenshooui/react-multi-select": "^1.1.5",
"antd": "^3.12.1",
"async": "^2.6.1",
"axios": "^0.18.0",
"bootstrap": "^4.1.2",
"classnames": "^2.2.6",
"esri-loader": "^2.4.0",
"fetch-jsonp": "^1.1.3",
"globalize": "^1.4.2",
"google-maps-react": "^1.1.11",
"highcharts": "^6.1.1",
"moment": "^2.22.2",
"npm": "^6.2.0",
"react": "^16.4.1",
"react-accessible-accordion": "^3.0.0",
"react-addons-css-transition-group": "^15.6.2",
"react-autosuggest": "^9.4.3",
"react-beautiful-dnd": "^10.0.4",
"react-bootstrap-table-next": "^3.1.2",
"react-bootstrap-table2-paginator": "^2.0.6",
"react-bootstrap-table2-toolkit": "^1.4.2",
"react-color": "^2.14.1",
"react-csv": "^1.0.15-RC2",
"react-custom-scrollbars": "^4.2.1",
"react-data-export": "^0.5.0",
"react-datepicker": "^2.8.0",
"react-dom": "^16.4.1",
"react-export-Excel": "^0.5.3",
"react-intl": "^2.4.0",
"react-lineto": "^3.1.2",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"react-scripts": "^1.1.4",
"react-select": "^2.0.0",
"react-simple-collapse": "^0.1.2",
"react-sortable-hoc": "^0.8.3",
"react-transition-group": "^2.4.0",
"react-widgets": "^5.0.0-7",
"react-widgets-globalize": "^5.0.20",
"react-widgets-moment": "^4.0.27",
"reactstrap": "^5.0.0",
"redux": "^3.7.2",
"redux-thunk": "^2.3.0",
"terraformer-wkt-parser": "^1.2.0",
"video-react": "^0.14.1",
"x2js": "^3.2.1",
"xlsx": "^0.14.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"eslint-plugin-react-hooks": "^1.3.0",
"react-docgen": "^2.21.0",
"react-styleguidist": "^7.1.0"
}
}
編集:また、私が私の支店を押したとき、私はGithubからこの警告を受けました
だから私はyarn.lock
をチェックし、私はそのバージョンがあることを見ることができます:
mem@^1.1.0:
version "1.1.0"
しかし、package.json
で定義されていない依存関係をアップグレードする方法は?
最後に、これを使用します。
https://stackoverflow.com/a/55378108/354132
私のpackage.json
ビルド用のスクリプト:
"build": "react-scripts --max_old_space_size=4096 build"
_
メモリの少ないサーバー(512MB)を使用している場合は、セットを試してみる必要があります。
1 - React-Scriptsでメモリを少なくします
"build": "react-scripts --max_old_space_size=256 build"
_
2 - https://create-react-app.dev/docs/advanced-configuration .envファイルに入るように、ソースマップの生成を無効にすることができます。
GENERATE_SOURCEMAP=false
_
あなたが追加した2つの依存関係が多くのメモリを使うかもしれません、それはあなたがジェンキンスから得たエラーを説明するでしょう。説明されているようにJenkinsに割り当てられたメモリを増やしましたか ここで ?
それがあなたを助けることを願っています!