2

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

> tmdb_admin@0.1.0 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!

4

1 回答 1

1

您的机器可能在构建期间内存不足。在“创建优化的生产构建......”之后,成功的构建会打印一堆东西

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

您可以通过在机器上打开另一个控制台并运行类似watch free.

截至 2 月 11 日(两天前),OOM 应该产生一个非零退出代码,所以当这种故障发生时它实际上是显而易见的。

于 2017-02-12T22:28:09.647 回答