npm build failed when adding custom ckeditor5 online build

860 views Asked by At

I have added ckeditor5 package using npm add file:./ckeditor5. When I run the code then the code is working fine but when I build it I get an error of npm ERR! [email protected] build: react-scripts build.

I guess the problem with npm add file:./ckeditor5 command. Below is the package.json file `

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@ckeditor/ckeditor5-react": "^3.0.2",
    "@material-ui/core": "^4.11.4",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.58",
    "@testing-library/jest-dom": "^5.12.0",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "ckeditor5-custom-build": "file:ckeditor5",
    "moment": "^2.29.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "socket.io-client": "^4.1.2",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "prebuild": "npm add file:./ckeditor5",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

You can see full error message on this link https://pastebin.com/embed_js/tT8uaQVe

Can anyone please help me to fix this.

1

There are 1 answers

2
χerфmiи On BEST ANSWER

I have found a solution for this question. You just need to increase the heap memory of javascript. To do this you can add the following build script in you package.json file

"build": "CI= react-scripts --max_old_space_size=4096 build",