【问题标题】:react-scripts build freezes at "Creating optimized build"react-scripts 构建冻结在“创建优化构建”
【发布时间】:2020-03-20 20:26:02
【问题描述】:

我已升级我的 CRA 项目以使用 react-scripts 3.2.0 当我运行 npm run build 时,我收到“正在创建优化的生产构建...”消息,但什么也没发生,它只是永远卡住了。

环境:

节点:v12.13.1

npm: 6.12.1

项目详情:

typescript、scss 和 scss 模块

package.json

    "dependencies": {
        "@types/jest": "^24.0.11",
        "@types/node": "^11.13.4",
        "@types/react": "^16.8.13",
        "@types/react-dom": "16.8.4",
        "classnames": "^2.2.5",
        "mobx": "^3.6.2",
        "mobx-react": "^4.4.3",
        "node-sass": "^4.12.0",
        "react": "^16.8.6",
        "react-scripts": "^3.2.0",
    },
    "devDependencies": {
        "@typescript-eslint/eslint-plugin": "^2.6.1",
        "@typescript-eslint/parser": "^2.6.1",
        "babel-plugin-transform-decorators-legacy": "^1.3.4",
        "enzyme": "^3.7.0",
        "enzyme-adapter-react-16": "^1.6.0",
        "husky": "^3.0.9",
        "lint-staged": "^9.4.2",
        "prettier": "^1.19.1",
        "typescript": "^3.2.4"
    },

tsconfig.json

{
    "compilerOptions": {
        "outDir": "build/dist",
        "module": "esnext",
        "target": "es5",
        "lib": ["es2016", "dom"],
        "sourceMap": true,
        "allowJs": true,
        "jsx": "preserve",
        "moduleResolution": "node",
        "rootDir": "src",
        "forceConsistentCasingInFileNames": true,
        "noImplicitReturns": true,
        "noImplicitThis": false,
        "noImplicitAny": false,
        "strictNullChecks": false,
        "suppressImplicitAnyIndexErrors": true,
        "noUnusedLocals": false,
        "experimentalDecorators": true,
        "skipLibCheck": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "strict": true,
        "resolveJsonModule": true,
        "isolatedModules": true,
        "noEmit": true
    },
    "include": ["src"],
    "types": ["react"]
}

【问题讨论】:

  • 你有没有想过这个问题?

标签: create-react-app react-scripts


【解决方案1】:

这很可能是因为内存不足。构建命令需要的 RAM 比您预期的要多。

【讨论】:

  • 我们正在寻找答案,但你只是在谈论 RAM
  • 感谢实例升级(内存增加)现在工作正常...
  • @AlanYong ,答案是增加系统的 RAM :)
  • 我看到很多答案都添加了这样的建议,但它的依据是什么?我在命令行中添加了-- --verbose,它添加了几行信息,但仍然停留在Creating an optimized production build...。我怎样才能让它变得冗长而不是被卡住?
猜你喜欢
  • 2019-02-10
  • 1970-01-01
  • 1970-01-01
  • 2022-08-23
  • 1970-01-01
  • 1970-01-01
  • 2017-08-28
  • 2012-10-06
  • 1970-01-01
相关资源
最近更新 更多