添加自定义 ckeditor5 在线构建时 npm 构建失败
npm build failed when adding custom ckeditor5 online build
我使用 npm add file:./ckeditor5
添加了 ckeditor5 包。当我 运行 代码时,代码工作正常,但是当我构建它时,出现 npm ERR! client@0.1.0 build: react-scripts build
.
错误
我猜是 npm add file:./ckeditor5
命令的问题。下面是 package.json 文件
`
{
"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"
]
}
}
您可以在此看到完整的错误消息 link https://pastebin.com/embed_js/tT8uaQVe
谁能帮我解决这个问题。
我找到了解决这个问题的方法。你只需要增加 javascript 的堆内存。为此,您可以在 package.json 文件
中添加以下构建脚本
"build": "CI= react-scripts --max_old_space_size=4096 build",
我使用 npm add file:./ckeditor5
添加了 ckeditor5 包。当我 运行 代码时,代码工作正常,但是当我构建它时,出现 npm ERR! client@0.1.0 build: react-scripts build
.
我猜是 npm add file:./ckeditor5
命令的问题。下面是 package.json 文件
`
{
"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"
]
}
}
您可以在此看到完整的错误消息 link https://pastebin.com/embed_js/tT8uaQVe
谁能帮我解决这个问题。
我找到了解决这个问题的方法。你只需要增加 javascript 的堆内存。为此,您可以在 package.json 文件
中添加以下构建脚本"build": "CI= react-scripts --max_old_space_size=4096 build",