我有NextJS的typescript应用程序,与30页和一些依赖关系。我试图建立它的自由示例有512 MB的内存,但有时甚至不能完成构建检查类型的有效性的步骤。我得到错误致命错误:无效的标记压缩接近堆限制分配失败- JavaScript堆内存不足
这里是package.json
{
"name": "app",
"scripts": {
"dev": "next dev",
"build": "NODE_OPTIONS=\" --max-old-space-size=512\" next build",
"prestart": "npm run build",
"start": "NODE_OPTIONS=\"--max-old-space-size=512\" next start","test": "start-server-and-test dev 3000 cypress:open",
"type:check": "yarn tsc --project tsconfig.json --pretty --noEmit",
"prepare": "husky install"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.3.0",
"@fortawesome/free-regular-svg-icons": "^6.0.0",
"@fortawesome/free-solid-svg-icons": "^6.0.0",
"@fortawesome/react-fontawesome": "^0.1.17",
"@lexical/react": "^0.7.1",
"@reduxjs/toolkit": "^1.7.2",
"@tangdw/react-viewer": "^3.2.7",
"antd": "^4.18.8",
"antd-dayjs-webpack-plugin": "^1.0.6",
"autoprefixer": "^10.4.7",
"bootstrap": "5.1.3",
"country-list": "^2.2.0",
"draft-js": "^0.11.7",
"draftjs-to-html": "^0.9.1",
"formik": "^2.2.9",
"formik-antd": "^2.0.4",
"html-to-draftjs": "^1.5.0",
"jsonwebtoken": "^8.5.1",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"next": "12.0.10",
"next-pwa": "^5.6.0",
"nprogress": "^0.2.0",
"postcss": "^8.4.14",
"query-string": "^7.1.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-draft-wysiwyg": "^1.15.0",
"react-feather": "^2.0.10",
"react-icons": "^4.3.1",
"react-multi-carousel": "^2.8.0",
"react-redux": "^7.2.6",
"react-share": "^4.4.1",
"react-show-more-text": "^1.5.2",
"react-slick": "^0.29.0",
"react-typical": "^0.1.3",
"react-viewer": "^3.2.2",
"tailwindcss": "^3.0.24",
"yup": "^0.32.11"
},
"devDependencies": {
"@types/node": "17.0.15",
"@types/react": "17.0.39",
"@types/react-show-more-text": "^1.4.2",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"@types/jsonwebtoken": "^8.5.8",
"@types/nprogress": "^0.2.0",
"@types/react-typical": "^0.1.0",
"cypress": "^9.5.1",
"eslint": "8.8.0",
"eslint-config-next": "12.0.10",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"husky": ">=6",
"lint-staged": ">=10",
"miragejs": "^0.1.43",
"prettier": "2.5.1",
"start-server-and-test": "^1.14.0",
"typescript": "4.5.5"
},
}
有办法解决吗?
1条答案
按热度按时间2guxujil1#
另一个选项是在本地生成,然后手动将生成文件上载到服务器。
我以前在我的服务器上做这个。