反应脚本启动错误代码

反应脚本启动错误代码

本文介绍了反应脚本启动错误代码 134,未启动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 react.js 为 windows 创建一个简单的电子应用程序.一切都很好,突然间,我遇到了一些错误,无法运行应用程序:

I'm trying to create a simple electron application for windows with react.js. Everything was fine, suddenly, I'm encountering some error, which doesn't let me run the application :

错误: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"
  },

推荐答案

  • 删除node_modules
  • 清除缓存
  • 删除temp文件夹s
  • 删除package_lock.json如果存在(如果使用npm应该存在)或yarn.lock(如果使用yarn)
  • 因为我们使用的是react,非正式官方使用npm install 可能会产生一些问题,使用yarn install
    • delete node_modules
    • clear cache
    • delete temp folders
    • delete package_lock.json if exists(should exist if using npm) or yarn.lock(if using yarn)
    • as we are using react, it is unofficially official that using npm install may create some problem, use yarn install
    • 一切正常.

      这篇关于反应脚本启动错误代码 134,未启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 05:09