Create react app `npm run build` only build favicon.ico file?

1.3k views Asked by At

I use https://github.com/facebookincubator/create-react-app as my boiler page.

So when i run npm run build on my local macbook it works fine.

But i tried to run it on my production server (Ubuntu on Digitalocean).

looks like it was only build favicon.ico but not the other js or even index.html

This is what happended.

deploy@tmdbAdmin03:/www/tmdb_admin$ sudo npm run build

> [email protected] build /www/tmdb_admin
> ./node_modules/react-scripts/bin/react-scripts.js build

Creating an optimized production build...
deploy@tmdbAdmin03:/www/tmdb_admin$ ls
README.md  build  node_modules  package.json  public  src
deploy@tmdbAdmin03:/www/tmdb_admin$ cd build
deploy@tmdbAdmin03:/www/tmdb_admin/build$ ls
favicon.ico

So this is my package.json

{
  "name": "tmdb_admin",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "autoprefixer-stylus": "0.10.0",
    "concurrently": "3.0.0",
    "react-scripts": "0.6.1",
    "stylus": "0.54.5"
  },
  "dependencies": {
    "bulma": "^0.2.3",
    "case-sensitive-paths-webpack-plugin": "^1.1.4",
    "es6-promise": "^4.0.5",
    "font-awesome": "^4.7.0",
    "isomorphic-fetch": "^2.2.1",
    "jwt-simple": "^0.5.0",
    "react": "^15.3.2",
    "react-dom": "^15.3.2",
    "react-pagify": "^2.1.1",
    "react-redux": "^4.4.5",
    "react-router": "^2.4.0",
    "react-router-redux": "^4.0.4",
    "react-slick": "^0.14.5",
    "redux": "^3.5.2",
    "redux-thunk": "^2.1.0",
    "segmentize": "^0.4.1",
    "slick-carousel": "^1.6.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "watch": "concurrently --names 'webpack, stylus' --prefix name 'npm run start' 'npm run styles:watch'",
    "build": "./node_modules/react-scripts/bin/react-scripts.js build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "styles": "stylus -u autoprefixer-stylus ./src/css/style.styl -o ./src/css/style.css",
    "styles:watch": "stylus -u autoprefixer-stylus -w ./src/css/style.styl -o ./src/css/style.css"
  }
}

So how can i fix this?

Thanks!

1

There are 1 answers

0
brandones On

Your machine is probably running out of memory during the build. A successful build prints a bunch of stuff after "Creating an optimized production build..."

See https://github.com/facebookincubator/create-react-app/issues/1493

You can verify that this is what's happening by opening another console on the machine and running something like watch free.

As of Feb 11 (two days ago) an OOM should produce a non-zero exit code, so it'll actually be obvious when this kind of failure happens.