react-scripts 启动错误代码 134,未启动应用程序
Posted
技术标签:
【中文标题】react-scripts 启动错误代码 134,未启动应用程序【英文标题】:react-scripts start error code-134, not starting application 【发布时间】:2020-05-21 23:43:45 【问题描述】:我正在尝试使用 react.js 为 Windows 创建一个简单的电子应用程序。一切都很好,突然,我遇到了一些错误,这让我无法运行应用程序:
错误:https://pastebin.com/awMi4UBM (react-scripts start
)
错误:https://pastebin.com/xeH3A1Dx(rescripts start
)
我的package.json
部分:
....
"scripts":
"start": "rescripts start",
"startb": "react-scripts start",
"build": "rescripts build",
"test": "rescripts test",
"eject": "react-scripts eject",
"postinstall": "electron-builder install-app-deps",
"preelectron-pack": "yarn build",
"electron-pack": "electron-builder build -mw",
"electron-dev": "concurrently \"BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\""
,
...
也贴在这里:
react-scripts start
的错误:
yarn run v1.17.3
$ react-scripts start
i 「wds」: Project is running at http://0.0.0.0:3000/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from E:\gits\telapoka-dev\telapoka-react\public
i 「wds」: 404s will fallback to /index.html
Starting the development server...
<--- Last few GCs --->
[2260:0000019DDCF58EB0] 134175 ms: Scavenge 1375.7 (1424.0) -> 1375.4 (1424.5) MB, 11.0 / 0.0 ms (average mu = 0.124, current mu = 0.023) allocation failure
[2260:0000019DDCF58EB0] 137527 ms: Mark-sweep 1376.1 (1424.5) -> 1375.8 (1424.5) MB, 3339.8 / 0.0 ms (average mu = 0.070, current mu = 0.014) allocation failure scavenge might not su
cceed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0000001B64F5C5C1]
1: StubFrame [pc: 0000001B64F4EC05]
Security context: 0x03045269e6e9 <JSObject>
2: replace [00000304526905E9](this=0x03b789806cc9 <String[80]: E:\gits\telapoka-dev\telapoka-react\node_modules\react-file-viewer\dist\index.js>,0x014e3ebde1c1 <JSRegExp <String[2]:
\\>>,0x014cc71b23e1 <String[1]: />)
3: _append [000001ED43DEE861] [E:\gits\telapoka-dev\telapoka-react\node_modules\@babel\gener...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - javascript heap out of memory
1: 00007FF761E3C6AA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
2: 00007FF761E17416 node::MakeCallback+4534
3: 00007FF761E17D90 node_module_register+2032
4: 00007FF76213189E v8::internal::FatalProcessOutOfMemory+846
5: 00007FF7621317CF v8::internal::FatalProcessOutOfMemory+639
6: 00007FF762317F94 v8::internal::Heap::MaxHeapGrowingFactor+9620
7: 00007FF76230EF76 v8::internal::ScavengeJob::operator=+24550
8: 00007FF76230D5CC v8::internal::ScavengeJob::operator=+17980
9: 00007FF762316317 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00007FF762316396 v8::internal::Heap::MaxHeapGrowingFactor+2454
11: 00007FF762440637 v8::internal::Factory::NewFillerObject+55
12: 00007FF7624BD826 v8::internal::operator<<+73494
13: 0000001B64F5C5C1
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Process finished with exit code 134
rescripts start
的错误:
yarn electron-dev
yarn run v1.17.3
$ concurrently "BROWSER=none yarn start" "wait-on http://localhost:3000 && electron ."
[0] 'BROWSER' is not recognized as an internal or external command,
[0] operable program or batch file.
[0] BROWSER=none yarn start exited with code 1
依赖关系:
"dependencies":
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"concurrently": "^5.1.0",
"copy-clipboard-js": "^1.0.3",
"dialog": "^0.3.1",
"electron-is-dev": "^1.1.0",
"fs": "^0.0.1-security",
"react": "^16.12.0",
"react-ace": "^8.0.0",
"react-awesome-button": "^6.5.1",
"react-collapsible": "^2.6.2",
"react-dom": "^16.12.0",
"react-file-viewer": "^1.2.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.0",
"react-welcome-page": "^0.2.1",
"remote": "^0.2.6",
"wait-on": "^4.0.0"
,
开发依赖:
"devDependencies":
"@rescripts/cli": "^0.0.13",
"@rescripts/rescript-env": "^0.0.11",
"electron": "^8.0.0",
"electron-builder": "^22.3.2",
"typescript": "^3.7.5"
,
【问题讨论】:
【参考方案1】: 删除node_modules
清除缓存
删除temp
文件夹s
如果存在则删除package_lock.json
(如果使用npm,则应该存在)或yarn.lock
(如果使用yarn)
由于我们使用的是react,非正式官方说使用npm install
可能会产生一些问题,请使用yarn install
一切都应该正常。
【讨论】:
以上是关于react-scripts 启动错误代码 134,未启动应用程序的主要内容,如果未能解决你的问题,请参考以下文章
无法启动 MongoDB 服务器“react-scripts”未被识别为内部或外部命令
从 Typescript 文件导入时,Javascript 代码在 react-scripts 构建中出现“尝试导入错误:”