naomi
naomi

Reputation: 2643

react-scripts build freezes at "Creating optimized build"

I have upgraded my CRA project to use react-scripts 3.2.0 When I run npm run build I get the "Creating an optimized production build..." message, but then nothing happens, its just stuck forever.

Environment:

node: v12.13.1

npm: 6.12.1

Project details:

typescript, scss and scss modules

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"]
}

Upvotes: 5

Views: 8463

Answers (1)

Surya Mahla
Surya Mahla

Reputation: 513

This is most probably because of shortage of RAM. Build command requires much more RAM than you'd expect.

Upvotes: 8

Related Questions