create-react-app 长时间启动 && 长时间重建 && 随机崩溃

ghhkc1vu  于 2个月前  发布在  React
关注(0)|答案(4)|浏览(36)

描述问题

我刚刚更新到TypeScript + React的最新版本,然后遇到了这个问题👍

你尝试恢复依赖了吗?

是的,我尝试了。
证据:


我的依赖项:
"dependencies": { "@testing-library/jest-dom": "^5.11.5", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "clsx": "^1.1.1", "date-fns": "^2.16.1", "history": "^5.0.0", "idb": "^5.0.7", "nanoid": "^3.1.16", "node-sass": "^4.14.1", "normalize.css": "^8.0.1", "react": "^17.0.1", "react-dom": "^17.0.1", "react-redux": "^7.2.2", "react-redux-loading-bar": "^5.0.0", "react-router-dom": "^5.2.0", "react-scripts": "^4.0.0", "react-spring": "^8.0.27", "redux": "^4.0.5", "redux-devtools-extension": "^2.13.8", "redux-logger": "^3.0.6", "redux-thunk": "^2.3.0", "source-map-explorer": "^2.5.0" }, "devDependencies": { "@types/jest": "^26.0.15", "@types/node": "^14.14.6", "@types/react": "^16.9.55", "@types/react-dom": "^16.9.9", "@types/react-redux": "^7.1.9", "@types/react-router-dom": "^5.1.6", "@types/redux-logger": "^3.0.8", "@typescript-eslint/eslint-plugin": "^4.6.0", "@typescript-eslint/parser": "^4.6.0", "babel-eslint": "^10.1.0", "eslint-config-airbnb-typescript": "^12.0.0", "eslint-config-prettier": "^6.15.0", "eslint-plugin-import": "^2.22.0", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-no-use-extend-native": "^0.5.0", "eslint-plugin-optimize-regex": "^1.2.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-sonarjs": "^0.5.0", "eslint-plugin-unicorn": "^23.0.0", "husky": "^4.3.0", "lint-staged": "^10.5.0", "prettier": "^2.1.2", "typescript": "^4.0.5" },

你在用户指南中搜索了哪些术语?

是的,我搜索了。

环境

PS C:\Users\Melon\Desktop\aviasales-test-task> npx create-react-app --info npx: 已安装(翻译:安装)91 在22.017秒内 Environment Info: 当前create-react-app的版本:4.0.0 正在从C:\Users\Melon\AppData\Roaming\npm-cache_npx\3908\node_modules\create-react-app运行 系统: 操作系统:Windows 10 10.0.18363 CPU:(4) x64 Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz Binaries: Node: 14.14.0 - C:\Program Files\nodejs\node.EXE Yarn: 未找到 npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD 浏览器: Chrome: 未找到 Edge: Spartan (44.18362.449.0) Internet Explorer: 未找到 (我不知道为什么这个东西没有检测到Firefox。Firefox-DEV: 83.0b4 npmPackages: react: ^17.0.1 => 17.0.1 react-dom: ^17.0.1 => 17.0.1 react-scripts: ^4.0.0 => 4.0.0 npmGlobalPackages: create-react-app: 未找到

重现问题的步骤

你可以克隆我的项目并尝试( https://github.com/MeloncholyShiro/-Aviasales-Test-Task- )

  1. npm run start
  2. 在文件中修复任何内容,例如5-10分钟的活动工作
  3. 获得崩溃👍

实际行为

我有一条跟踪信息😅
`<--- 最后几次GC -->
[10888:000002130E0BD4D0] 1685067 ms: Mark-sweep 2022.2 (2072.4) -> 2005.9 (2073.2) MB, 2627.5 / 0.1 ms (average mu = 0.210, current mu = 0.068)分配失败回收可能不会成功
[10888:000002130E0BD4D0] 1686782 ms: Mark-sweep 2022.2 (2073.4) -> 2003.9 (2072.4) MB, 1618.1 / 0.1 ms (average mu = 0.154, current mu = 0.057)分配失败回收可能不会成功
<--- JS堆栈跟踪 -->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF72FB61C0F napi_wrap+109135
2: 00007FF72FB06B56 v8::internal::OrderedHashTablev8::internal::OrderedHashSet,1::NumberOfElementsOffset+33350
3: 00007FF72FB7926 node::OnFatalError+294
4: 00007FF7303D62FE v8::internal::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF7303BB14D v8::sharedArrayBuffer::Externalize+781
6: 00007FF73026557C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516
7: 00007FF7302708DA v8::internal::Heap::ProtectUnprotectedMemoryChunks+1258
8: 00007FF73026DA89 v8::internal::Heap::PageFlagsAreConsistent+2457
9: 00007FF730262621 v8::internal::Heap::CollectGarbage+2033
10: 00007FF730260825 v8::internal::Heap::AllocateExternalBackingStore+1365
11: 00007FF730280D47 v8::internal::Factory::NewFillerObject+183
12: 00007FF72FFAE561 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1409
13:

j13ufse2

j13ufse21#

确认长时间重建。在我的项目中,将react/react-dom/react-scripts更新到^17/^17/^4后,重建速度明显变慢。在将包恢复到^16/^16/^3后,重建速度再次变快。

xdyibdwo

xdyibdwo3#

我们在使用最新版本的CRA进行开发时遇到了相同的问题,发现当在create-react-app项目中有一个自定义的.eslintrc时,它运行速度非常慢。当我们移除自定义的eslint配置后,开发模式下的热重载恢复到了正常速度。这可能是因为EXTEND_ESLINT默认是开启的。目前我们暂时回退到CRA@^3。

bvk5enib

bvk5enib4#

这个问题已经被自动标记为过时,因为它没有任何最近的活动。如果没有发生任何进一步的活动,它将在5天后被关闭。

相关问题